-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitconfig
111 lines (97 loc) · 4.35 KB
/
gitconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
[include]
path = ~/.gitconfig.private
[includeIf "gitdir:~/dotfiles/"]
path = ~/.gitconfig.personal
[core]
excludesfile = ~/.gitignore_global
editor = vim
[alias]
main-branch = !git symbolic-ref refs/remotes/origin/HEAD | cut -d'/' -f4 # auto determines master vs main based on the current repo
aliases = config --get-regexp alias
st = status
stt = status . # status of current directory
s = status -s # Short status
a = add
aa = add --all
au = update-index --again # re-add only updated files that are already staged
aui = au
readd = au
di = diff
dis = diff --staged
dimods = !git diff --cached --quiet --exit-code || git diff $(git diff --staged --name-only) # "git diff modified staged" to see the diffs of *only* worktree files that were also *already* staged. So that you can see just the files you staged previously that you then modified again. This is perfect to combine with `readd`. (the first part before the || is needed for when there are no staged files to prevent it from doing a regular git diff on all worktree files)
readd-preview = dimods # easier mnemonic to pair with 'readd'
readd-p = readd-preview
distat = diff --stat # --stat shows stats on lines changed per file in diff
disstat = diff --staged --stat
# Shows the diff from before the latest pull/commit/reflog change and now
# Can also do things like master@{10 minutes ago} and such
showdifflatestpull = diff master@{1} master
show-names = show --name-status # Only show files changed in the latest commit instead of all the diffs too
pl = pull
pll = pull
ps = push
psh = push
shinratensei = push # The almighty
banshotenin = pull # The universal
ci = commit
cia = commit --amend
ciane = commit --amend --no-edit
cim = commit -m
co = checkout
cob = checkout -b # Creates new local branch
cobb = checkout - # Switches to previous branch
com = "!f(){ git checkout $(git main-branch) $@;}; f" # Switch to main branch
b = branch
bd = branch -d
b-recent = branch --sort=-committerdate # Shows branches with most recently committed first
br = branch
ba = branch -av
bra = branch -av
ress = restore --staged
rests = restore --staged
rs = ress
l = log --pretty=oneline -n 20 --graph --abbrev-commit
logdiffs = log -p
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all --date=local
tree = log --graph --decorate --pretty=format:\"%C(yellow)%h %Cred%cr %Cblue(%an)%C(cyan)%d%Creset %s\" --abbrev-commit --all
root = rev-parse --show-toplevel # Return repo's root dir, useful for shell prompts
rebasem = "!f(){ git rebase $(git main-branch) $@;}; f" # Rebase onto main branch (instead of typing 'git rebase master')
rebm = rebasem
# Run this when you have a branch that was forked off another branch, and that original branch was squash merged into master. https://stackoverflow.com/a/70994400/1807163
# Ex. `git rebase-onto feature-b-off-a feature-a` where feature-a is the branch that was squash merged into master
rebase-onto = "!f() { git rebase --onto master $(git merge-base \"$1\" \"$2\") \"$1\"; }; f"
[diff]
# Automatically detect renames/moves of files in git diffs, so that it
# doesn't show the full text of the diff as long as the similarity
# between the files in a detected add/delete pair is at least 50%.
# Will just show the actual changes between the files.
renames = true
# Shows removed whitespace in diffs
wsErrorHighlight = all
[diff "jupyternotebook"]
# Ignores diffing the outputs of cells since it makes doing a 'git diff'
# very long (multiple minutes) if there are a lot of outputs
command = git-nbdiffdriver diff --ignore-outputs
[merge "jupyternotebook"]
driver = git-nbmergedriver merge %O %A %B %L %P
name = jupyter notebook merge driver
[difftool "nbdime"]
cmd = git-nbdifftool diff \"$LOCAL\" \"$REMOTE\" \"$BASE\"
[difftool]
prompt = false
[mergetool "nbdime"]
cmd = git-nbmergetool merge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
[mergetool]
prompt = false
[pager]
branch = false
[pull]
rebase = true
[init]
defaultBranch = master
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true