-
Notifications
You must be signed in to change notification settings - Fork 7
/
.gitconfig
159 lines (133 loc) · 5.63 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
[include]
path = .gitconfig_hub
[user]
email = felix.dietze@rwth-aachen.de
name = Felix Dietze
[pager]
diff = diff-so-fancy | less --RAW-CONTROL-CHARS
show = diff-so-fancy | less --RAW-CONTROL-CHARS
log = diff-so-fancy | less --RAW-CONTROL-CHARS
reflog = diff-so-fancy | less --RAW-CONTROL-CHARS
[push]
default = current
followTags = true # Automatically pushes annotated tags (but not leightweight tags!)
[pull]
ff = only
rebase = true
[fetch]
prune = true # remove old branches on fetch
[branch]
autosetuprebase = always
[merge]
; ff = only
ignore-space-change = true
tool = meld
conflictstyle = diff3 # this allows to show 3 panes in meld, https://stackoverflow.com/questions/27417656/should-diff3-be-default-conflictstyle-on-git/70387424#70387424
[rerere]
enabled = 1 # Reuse recorded resolution of conflicted merges: https://git-scm.com/docs/git-rerere
[rebase]
autoStash = true
autoSquash = true # useful for `git commit --fixup <hash>` (https://fle.github.io/git-tip-keep-your-branch-clean-with-fixup-and-autosquash.html)
[status]
showUntrackedFiles = all
[transfer]
; fsckobjects = true
[diff]
algorithm = histogram # https://luppeng.wordpress.com/2020/10/10/when-to-use-each-of-the-git-diff-algorithms/
indentHeuristic = true
wordRegex = [A-Z][a-z]*|[a-z]+|[^[:space:]] # see camel case as separate words
colorMoved = zebra
[diff "scala"]
xfuncname = ^\\s*(.*(def|object|class|trait) .*)$
[diff "markdown"]
xfuncname = "^#+.*$"
[commit]
verbose = true # show diff in editor when committing
[apply]
ignoreWhitespace = change # do not produce whitespace conflicts
[alias]
st = status
co = checkout
com = checkout master
cob = checkout -b
cot = "!TEMP=$(mktemp -d); f() { git worktree prune && git worktree add $TEMP $1 && zsh -c \"cd $TEMP; zsh\";}; f" # checkout branch in temporary directory
ci = commit
amend = commit --amend
unstage = reset HEAD
prev = reset HEAD~1
fixup = !zsh -ic 'git commit --fixup $(git-select-commit)'
ignore = "!cd -- ${GIT_PREFIX:-.}; f() { echo \"$1\" >> .gitignore; }; f" # add to .gitignore in current directory
cl = clone
br = branch
brr = branch -r
lg = log --pretty=format:'%Cred%h %C(reset)%C(dim)%ad%x08%x08%x08%x08%x08%x08%x08%x08%x08%Creset%C(blue) %an %Creset%s%C(yellow)%d %Cgreen(%ar)%Creset' --abbrev-commit --date=iso --graph --date-order
lga = log --branches --remotes --tags --full-history --graph --pretty=format:'%C(yellow)%d %Cred%h %C(reset)%C(blue)%an %C(reset)%s %Cgreen(%ar)%C(reset)'
df = diff --color-words='[A-Z][a-z]*|[a-z]+|[^[:space:]]' --irreversible-delete --find-copies-harder --find-copies --ignore-space-at-eol --ignore-space-change --ignore-all-space --ignore-blank-lines --inter-hunk-context=2
dfs = df --staged
sdf = show --color-words
p = push
pf = push --force-with-lease
peng = push --force-with-lease
wupp = push
up = pull --rebase --autostash # somehow git does not pick these up from the config automatically anymore
u = up
f = fetch
fa = fetch --all
po = !git push --set-upstream origin \"$(git rev-parse --abbrev-ref HEAD)\" # push current branch to origin
dbr = "!f() { git branch -D $1; git push origin :$1;}; f" # delete local and remote branch
dtag = "!f() { git tag -d $1; git push origin :$1;}; f" # delete local and remote tag
wip = "!git add -A; git commit --message=\"WIP: `git diff --name-only --staged | xargs -L 1 basename | paste -sd \",\"`\""
wipbr = "!f() { git cob $1; git wip; git po;}; f" # commit and push everything on a new branch
pr = "!f() { ! git diff --staged --quiet && git cob \"$1\" && git ci && gh pr create --fill;}; f"
prm = "!f() { ! git diff --staged --quiet && git cob \"$1\" && git ci && gh pr create --fill -l=\"ready-to-merge-squash\" ;}; f"
prd = "!f() { ! git diff --staged --quiet && git cob \"$1\" && git ci && gh pr create --fill --draft;}; f"
prune-local = "!git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == \"[gone]\" {sub(\"refs/heads/\", \"\", $1); print $1}'); do (echo -n \"DELETE $branch? [y/N]: \"; read -r answer; [[ \"$answer\" =~ ^(y|Y) ]]) && git branch -D $branch; done"
prune-local-force = "!git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == \"[gone]\" {sub(\"refs/heads/\", \"\", $1); print $1}'); do git branch -D $branch; done"
ss = stash save --include-untracked
sski = stash save --include-untracked --keep-index
sp = stash pop
rb = rebase
rbm = rebase master
rbom = rebase origin/master
rbod = rebase origin/develop
rba = rebase --abort
rbs = rebase --skip
rbc = rebase --continue
rbi = rebase -i
rbim = rebase -i master
rbiom = rebase -i origin/master
m = merge
ma = merge --abort
ms = merge --skip
mc = merge --continue
cp = cherry-pick
cpa = cherry-pick --abort
cps = cherry-pick --skip
cpc = cherry-pick --continue
h = help
[color]
branch = auto
diff = auto
status = auto
ui = true
[color "diff"]
old = red bold
new = green bold
meta = yellow
frag = magenta bold
commit = yellow bold
whitespace = red reverse
[color "status"]
added = green
changed = yellow
untracked = blue
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22