forked from alfunx/.dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
488 lines (397 loc) · 13.4 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
[user]
name = Toaster192
email = toastercz@gmail.com
signingkey = toastercz@gmail.com
[core]
editor = vim
whitespace = fix,trailing-space,cr-at-eol
hooksPath = ~/.config/git/hooks
excludesfile = ~/.ignore
commitGraph = true
[credential]
helper = cache --timeout=7200
[color]
advice = true
branch = true
diff = true
grep = true
interactive = true
pager = true
push = true
remote = true
showBranch = true
status = true
transport = true
ui = true
[color "branch"]
current = 14
local = 10
remote = 9
upstream = 208
plain = 15
[color "decorate"]
branch = 2 bold
remoteBranch = 1 bold
tag = 3 bold
stash = 5 bold
HEAD = 6 bold
grafted = 4 bold
[color "diff"]
context = 15
meta = 4 bold reverse
frag = 3 bold reverse
func = 166 bold reverse
commit = 3 bold
old = 9
new = 10
oldMoved = 8
newMoved = 14
oldMovedAlternative = 8
newMovedAlternative = 14
whitespace = 1 reverse
[color "diff-highlight"]
oldHighlight = reverse
oldReset = noreverse
[color "interactive"]
prompt = 4 bold
header = 15 bold
help = 15
error = 1
[color "push"]
error = 1 bold
[color "transport"]
rejected = 1 bold
[color "remote"]
hint = 5 bold
warning = 3 bold
success = 2 bold
error = 1 bold
[color "status"]
header = 15 bold
added = 14 bold
changed = 11 bold
untracked = 9 bold
branch = 2 bold
nobranch = 3 bold
localBranch = 2 bold
remoteBranch = 1 bold
unmerged = 9 bold reverse
[commit]
gpgSign = true
status = true
[diff]
algorithm = histogram
tool = vimdiff
colorMoved = default
renames = copy
mnemonicPrefix = true
wsErrorHighlight = all
statGraphWidth = 40
[diff "bin"]
textconv = hexdump -v -C
[difftool]
prompt = true
[difftool "vimdiff"]
cmd = vimdiff "$LOCAL" "$REMOTE"
[merge]
ff = false
conflictStyle = merge
tool = vimmerge
[mergetool]
prompt = true
keepBackup = false
writeToTemp = true
[mergetool "vimmerge"]
cmd = vimmerge "$MERGED" "$BASE" "$LOCAL" "$REMOTE"
trustExitCode = true
[mergetool "vim-diffconflicts"]
cmd = vim -f -c DiffConflictsWithHistory "$MERGED" "$BASE" "$LOCAL" "$REMOTE"
trustExitCode = true
[mergetool "fugitive"]
cmd = vim -f -c Gvdiff "$MERGED"
[rebase]
missingCommitsCheck = warn
abbreviateCommands = false
instructionFormat = %<(60,trunc)%s %cn <%ce> [GPG: %G?% GK]
untrackedCache = true
autoSquash = true
stat = true
[fetch]
prune = false
output = compact
[pull]
rebase = interactive
[push]
default = simple
gpgSign = if-asked
followTags = true
[submodule]
fetchJobs = 0
[grep]
lineNumber = true
patternType = perl
[interactive]
singlekey = true
diffFilter = "/usr/share/git/diff-highlight/diff-highlight | less"
[branch]
autoSetupMerge = true
autoSetupRebase = always
[status]
short = true
branch = true
showStash = true
submoduleSummary = true
renames = copy
[log]
abbrevCommit = true
decorate = short
date = format:%a, %Y-%m-%d %R (%z)
follow = true
graphColors = 1,2,3,4,5,6,8,166,9,10,11,12,13,14,15,208
showRoot = true
mailmap = true
[pager]
log = "/usr/share/git/diff-highlight/diff-highlight | less"
show = "/usr/share/git/diff-highlight/diff-highlight | less"
diff = "/usr/share/git/diff-highlight/diff-highlight | less"
[rerere]
enabled = true
[protocol]
version = 2
[column]
ui = auto,column
[web]
browser = chromium
[advice]
pushUpdateRejected = false
statusHints = false
statusUoption = false
commitBeforeMerge = false
resolveConflict = false
implicitIdentity = false
detachedHead = false
amWorkDir = true
rmHints = true
addEmbeddedRepo = false
ignoredHook = true
waitingForEditor = false
[format]
pretty = lf
[pretty]
lo = tformat:%C(auto)%h%C(reset)%C(auto)%d%C(reset) %s %C(italic blue)%ad%C(reset) %C(241)%aN%C(reset)
lc = format:%C(auto)%h%C(reset) %C(white)-%C(reset) %C(italic blue)%ad%C(reset) %C(italic cyan)(%ar)%C(reset)%C(auto)%d%C(reset)%n %C(white)⤷%C(reset) %s %C(241)- %aN <%aE>%C(reset)%n
lt = format:%C(auto)%h%C(reset) %C(white)-%C(reset) %C(italic blue)%ad%C(reset) %C(italic cyan)(%ar)%C(reset)%C(auto)%d%C(reset)%n %C(white)⤷%C(reset) %s %C(241)- %aN <%aE>%C(reset)%n%w(0,7,7)%+(trailers:only,unfold)
lf = format:%C(auto)%h%C(reset)%C(auto)%d%C(reset) %C(italic 239)[P: %p] [T: %t]%C(reset)%n%C(white)Author:%C(reset) %aN %C(241)<%aE>%C(reset)%n %C(italic blue)%ad%C(reset) %C(italic cyan)(%ar)%C(reset)%n%C(white)Commit:%C(reset) %cN %C(241)<%cE>%C(reset) %C(italic 239)[GPG: %G?% GK]%C(reset)%n %C(italic blue)%cd%C(reset) %C(italic cyan)(%cr)%C(reset)%w(0,4,4)%n%n%C(bold)%s%C(reset)%n%n%-b%n%n%-N%n
rlo = tformat:%C(auto)%h%C(reset) %C(bold yellow)(%C(magenta)%gd%C(bold yellow))%C(reset)%C(auto)%d%C(reset) %gs %C(italic blue)%ad%C(reset) %C(241)%aN%C(reset)
rlc = format:%C(auto)%h%C(reset) %C(white)-%C(reset) %C(italic blue)%ad%C(reset) %C(italic cyan)(%ar)%C(reset)%C(auto)%d%C(reset)%n %C(white)⤷%C(reset) %s %C(241)- %aN <%aE>%C(reset)%n %C(white)⤷%C(reset) %C(bold yellow)(%C(magenta)%gd%C(bold yellow))%C(reset) %gs %C(241)- %gN <%gE>%C(reset)%n
rlt = format:%C(auto)%h%C(reset) %C(white)-%C(reset) %C(italic blue)%ad%C(reset) %C(italic cyan)(%ar)%C(reset)%C(auto)%d%C(reset)%n %C(white)⤷%C(reset) %s %C(241)- %aN <%aE>%C(reset)%n %C(white)⤷%C(reset) %C(bold yellow)(%C(magenta)%gd%C(bold yellow))%C(reset) %gs %C(241)- %gN <%gE>%C(reset)%n%w(0,7,7)%+(trailers:only,unfold)
rlf = format:%C(auto)%h%C(reset) %C(bold yellow)(%C(magenta)%gd%C(bold yellow))%C(reset)%C(auto)%d%C(reset) %C(italic 239)[P: %p] [T: %t]%C(reset)%n%C(white)Author:%C(reset) %aN %C(241)<%aE>%C(reset)%n %C(italic blue)%ad%C(reset) %C(italic cyan)(%ar)%C(reset)%n%C(white)Commit:%C(reset) %cN %C(241)<%cE>%C(reset) %C(italic 239)[GPG: %G?% GK]%C(reset)%n %C(italic blue)%cd%C(reset) %C(italic cyan)(%cr)%C(reset)%n%C(white)Reflog:%C(reset) %gN %C(241)<%gE>%C(reset)%n %C(italic)%gs%C(reset)%w(0,4,4)%n%n%C(bold)%s%C(reset)%n%n%-b%n%n%-N%n
[alias]
ec = "!f() { [ -f \"${XDG_CONFIG_HOME:-$HOME/.config}\"/dotfiles.conf ] && . \"${XDG_CONFIG_HOME:-$HOME/.config}\"/dotfiles.conf; git --git-dir=\"$dotfiles_dir\" config --global --edit; }; f"
ecl = config --edit
# log, current branch
l = log --pretty=lc --graph
lo = log --pretty=lo --graph --date=human
ls = log --pretty=lo --graph --date=human --simplify-by-decoration
lf = log --pretty=lf --graph
ld = log --pretty=lf --graph --cc --stat
lp = log --pretty=lf --graph --cc --patch
# log, all branches+tags on all remotes
la = log --pretty=lc --graph --all
lao = log --pretty=lo --graph --date=human --all
las = log --pretty=lo --graph --date=human --simplify-by-decoration --all
laf = log --pretty=lf --graph --all
lad = log --pretty=lf --graph --cc --stat --all
lap = log --pretty=lf --graph --cc --patch --all
# log, all branches+tags on remotes 'origin' and 'upstream'
lg = log --pretty=lc --graph --branches=* --tags=* --remotes=origin --remotes=upstream
lgo = log --pretty=lo --graph --date=human --branches=* --tags=* --remotes=origin --remotes=upstream
lgs = log --pretty=lo --graph --date=human --simplify-by-decoration --branches=* --tags=* --remotes=origin --remotes=upstream
lgf = log --pretty=lf --graph --branches=* --tags=* --remotes=origin --remotes=upstream
lgd = log --pretty=lf --graph --cc --stat --branches=* --tags=* --remotes=origin --remotes=upstream
lgp = log --pretty=lf --graph --cc --patch --branches=* --tags=* --remotes=origin --remotes=upstream
# reflog
rl = reflog --pretty=rlc
rlo = reflog --pretty=rlo
rlf = reflog --pretty=rlf
rld = reflog --pretty=rlf --stat
# stash
sl = stash list --pretty=rlc
slo = stash list --pretty=rlo
slf = stash list --pretty=rlf
sld = stash list --pretty=rlf --stat
sls = stash show --patch
# inspection
sh = show --stat --cc --summary --patch
grep = grep -Ii
# diff
d = diff -c
ds = diff --find-renames --stat --cc -c
dc = diff --cached -c
dl = diff --cached -c HEAD~
du = diff --cached -c @{u}
dr = "!f() { git diff -c ${1:-HEAD}~..${1:-HEAD}; }; f"
# status
s = status
si = status --ignored
sa = status --ignored --untracked-files
# index
a = add
aa = add --all
au = add --update
ai = add --interactive
ap = add --patch
an = add --intent-to-add
u = reset HEAD --
up = reset --patch HEAD --
# commit
c = commit --verbose
cn = commit --verbose --no-verify
cc = commit --verbose -c
cf = commit --verbose --fixup
cs = commit --verbose --squash
ca = commit --verbose --amend
can = commit --verbose --amend --no-edit
# checkout
co = checkout
com = checkout master --
cod = checkout develop --
cob = checkout -b
# branch
b = branch
bc = branch --contains
bd = branch --delete --force
bl = branch -vv
bla = branch --all -vv
# tag
t = tag
tc = tag --contains
td = tag --delete
# network (in)
cl = clone
p = pull
f = fetch --tags
ff = fetch --force --tags
fa = fetch --all --tags
fp = fetch --prune --tags
ffp = fetch --prune --force --tags
fap = fetch --prune --all --tags
pfa = "!f() { git remote | xargs -I@ -P0 git fetch --tags \"$@\" @; }; f"
# network (out)
pu = push
pun = push --no-verify
puf = push --force-with-lease
puff = push --force
# submodule
sub = submodule
subu = submodule update --init --recursive
# merge
m = merge
ma = merge --abort
mc = merge --continue
mff = merge --ff-only
mnc = "!f() { git merge --no-commit --no-ff \"$@\"; EC=$?; git merge --abort; exit $EC; }; f"
# rebase
r = rebase
ra = rebase --abort
rc = rebase --continue
rq = rebase --quit
rs = rebase --skip
ret = rebase --edit-todo
rsh = rebase --show-current-patch
# interactive rebase
ri = rebase --interactive
riu = rebase --interactive @{u}
rim = rebase --interactive master
rid = rebase --interactive develop
# cherry-pick
cp = cherry-pick
cpa = cherry-pick --abort
cpc = cherry-pick --continue
cpq = cherry-pick --quit
# revert
rv = revert
rva = revert --abort
rvc = revert --continue
rvq = revert --quit
# reset
re = reset
res = reset --soft
reh = reset --hard
# tools
mt = mergetool
dt = difftool
# w-commands
which = branch --all --contains
which-tag = describe --always --contains
who = shortlog --summary --numbered --no-merges
whoami = "!echo $(git config --get user.name) '<'$(git config --get user.email)'>'"
watch = "!f() { watch -ctn 2 git \"${@:-l}\"; }; f"
# initialize repository in current directory
# git this [<git-init-args>...]
this = "!f() { git init \"$@\" && git commit --message='Initialize' --allow-empty; }; f"
# show authors and and commit counts
# git thanks [<git-log-args>...]
thanks = "!f() { git log --pretty=tformat:'%aN <%aE>' \"$@\" | sort | uniq -c | sort -rn; }; f"
# open GitHub repository in browser
# git open [<remote>]
open = "!f() { URL=$(git config remote.${1:-origin}.url); xdg-open \"${URL%%.git}\"; }; f"
# set up remotes for fork
# git fork [<old-remote> [<new-remote>]]
fork = "!f() { URL=$(git config remote.${1:-origin}.url); git remote set-url ${1:-origin} \"$(echo \"$URL\" | perl -pe 's/(?<=[:\\/])[^:\\/]+(?=\\/[^\\/]+$)/alfunx/')\"; git remote add ${2:-upstream} \"$URL\"; git config branch.master.remote ${2:-upstream}; git config branch.master.pushRemote ${1:-origin}; }; f"
# fetch and checkout a GitHub pull request / a GitLab merge request
# git fetch-pr <remote> <number> [<branchname>]
# git fetch-mr <remote> <number> [<branchname>]
fetch-pr = "!f() { [ $# -lt 2 ] && echo 'usage: git pr <remote> <number>' 1>&2 && exit 1; it fetch $1 pull/$2/head:${3:-pr-$1-$2} && git checkout ${3:-pr-$1-$2}; }; f"
fetch-mr = "!f() { [ $# -lt 2 ] && echo 'usage: git mr <remote> <number>' 1>&2 && exit 1; it fetch $1 merge-requests/$2/head:${3:-mr-$1-$2} && git checkout ${3:-mr-$1-$2}; }; f"
# track all pull-requests / merge-requests
# git setup-fetch [<remote>]
setup-fetch = "!f() { git config --add remote.${1:-origin}.fetch \"+refs/pull/*/head:refs/remotes/${1:-origin}/pull-requests/*\"; git config --add remote.${1:-origin}.fetch \"+refs/merge-requests/*/head:refs/remotes/${1:-origin}/merge-requests/*\"; }; f"
# hard reset with commit before (use reflog to recover)
# git wipe [<commit>]
wipe = "!f() { git add --all && git commit --quiet --message='WIPE-SAVEPOINT' && git reset ${1:-HEAD~} --hard && git clean -fd; }; f"
# hard reset and clean (unrecoverable)
nuke = "!git reset --hard HEAD && git clean -fd"
# generate tags file
ctags = "!$HOME/.config/git/hooks/ctags"
# create/extend gitignore file
gitignore = gitignore
# fzf commands
fbr = fzf-branch
fco = fzf-checkout
fcoc = "!f() { git fzf-print-sha | xargs git checkout; }; f"
fsha = fzf-print-sha
fshow = fzf-show-commit
fstash = fzf-show-stash
# git git ...
git = "!git"
[trailer]
separators = ":#"
[url "git@github.com:"]
insteadOf = @gh:
[url "git@gitlab.com:"]
insteadOf = @gl:
[url "git@bitbucket.org:"]
insteadOf = @bb:
[url "aur@aur.archlinux.org"]
insteadOf = @aur:
[url "https://github.com/"]
insteadOf = gh://
[url "https://gitlab.com/"]
insteadOf = gl://
[url "https://bitbucket.org/"]
insteadOf = bb://
[url "https://aur.archlinux.org/"]
insteadOf = aur://
[svn]
rmdir = true
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[include]
path = .gitconfig.local
[includeIf "gitdir:~/projects/"]
path = ~/projects/.gitconfig
[includeIf "gitdir:~/development/"]
path = ~/development/.gitconfig