-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
343 lines (290 loc) · 14.5 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
[user]
name = Doug Ilijev
#email = [email protected]
[user] # DTMX
email = [email protected]
[include]
path = ~/dtmx.gitconfig
[include]
path = ~/g.gitconfig
[alias]
ci = commit
cm = commit -m
ca = commit -am
au = add -u
amend = commit --amend --no-edit # amend previous commit, don't change message
check = commit -m "[checkpoint]" # make a quick commit to be amended later
wip = commit -m "[wip]" # make a quick commit to be amended later
co = checkout
br = -c core.pager=cat branch
bv = branch -vv --no-color
sa = status # a for all calculations
ssa = status -s # a for all calculations (short)
ss = status -s --no-renames -uno --no-ahead-behind # default fast (short)
s = status --no-renames -uno --no-ahead-behind # default fast
su = status --no-renames -uno --no-ahead-behind # u for -uno (intent of which is "fast")
sf = status --no-renames -uno --no-ahead-behind --no-breaks # f for "fast"
changed = "!git diff $1~1 $1 #"
changes = "!git diff --stat $1~1 $1 #"
changedw = "!git diff -w $1~1 $1 #"
changesw = "!git diff -w --stat $1~1 $1 #"
df = diff
dc = diff --cached
dn = diff --name-status
dnn = diff --name-only
dnn1 = diff --name-only HEAD~1
dcn = diff --cached --name-status
dcnn = diff --cached --name-only
dst = diff --stat
dsst = diff --shortstat
dcst = diff --cached --stat
dcsst = diff --cached --shortstat
sn = show --name-status
snn = show --name-only
st = show --stat
sst = show --shortstat
msg = show --name-status --pretty=fuller # get the full (multiline) message (with dates) for the current commit, and files changed
lsf = ls-files
fp = fetch --all -p # fetch and prune all branches from all remotes
ff = merge --ff-only
fg = "!git ls-files | grep --color=auto -i -E $* #" # "file grep"
gr = grep -i -n --color=auto
mt = mergetool
mc = merge --continue
ma = merge --abort
rc = rebase --continue
ra = rebase --abort
pick = cherry-pick
pk = cherry-pick
pc = cherry-pick --continue
pa = cherry-pick --abort
rv = remote -v
sup = submodule update
undo = reset --hard HEAD
base = !git merge-base HEAD $1
lg = -c core.pager=cat log --pretty=crisp --date=iso-local -10 --topo-order
lga = log --pretty=crisp --date=iso-local --topo-order
lf = -c core.pager=cat log --pretty=crisp --date=iso-local -10 --first-parent
lfa = log --pretty=crisp --date=iso-local --first-parent
lfc = -c core.pager=cat log --pretty=crisp-cdate --date=iso-local --first-parent -10
lfca = log --pretty=crisp-cdate --date=iso-local --first-parent
lfs = -c core.pager=cat log --pretty=summary --date=format:%y-%m-%d --first-parent -10
glog = log --graph --date=iso-local
gl = -c core.pager=cat log --graph --pretty=crisp --date=iso-local -10
glc = -c core.pager=cat log --graph --pretty=crisp-cdate --date=iso-local -10
gla = log --graph --pretty=crisp --date=iso-local
glca = log --graph --pretty=crisp-cdate --date=iso-local
cf = config
cfg = config --global
cfl = config -l
cfgl = config --global -l
hash = rev-parse
head = rev-parse HEAD
hh = rev-parse --short
this = rev-parse --abbrev-ref HEAD # get the name of the current branch, for scripting
has = branch -a --contains # which branches contain the current commit
relhas = "!sh -c 'git branch -a --contains $1 | grep -E release\\|[/]master #' $*" # which branches contain the current commit
hasrel = !git relhas $*
context = "!git branch | sed -e 's/*/ /' | xargs -I % git lf -1 %"
context-remote = "!git branch -r | xargs -I % git lf -1 %"
nocontext = "!git branch | sed -e 's/*/ /' | xargs -I % git lf -1 % | rg -v 'origin[/]|master' | grep --color '[(].*[)]'"
# branches = "for-each-ref --sort='-authordate:iso8601' --format=' %(authordate:relative)%09%(refname:short)' $*"
# branches = "!sh -c 'git for-each-ref --sort=\"-authordate:iso8601\" --format=\" %(committerdate:iso8601)%09(%(committerdate:relative))%09%(refname:short)\" ${1:-refs/heads} #' $*"
branches = "!sh -c 'git for-each-ref --sort=\"-committerdate:iso8601\" --format=\" %(committerdate:iso8601)%09(%(committerdate:relative))%09%(refname:short)\" ${1:-refs/heads} #' $*"
brs = branches
#branches-local = "!git for-each-ref --sort='-authordate:iso8601' --format=' %(authordate:iso8601)%09(%(authordate:relative))%09%(refname:short)' refs/heads | grep -vP 'master|released?[/]'"
#branches-local = "!git for-each-ref --sort='-committerdate:iso8601' --format=' %(committerdate:iso8601)%09(%(committerdate:relative))%09%(refname:short)' refs/heads | grep -vE 'master|released?[/]'"
branches-local = branches
brl = branches
#branches-remote = "for-each-ref --sort='-authordate:iso8601' --format=' %(authordate:relative)%09%(refname:short)' refs/remotes"
branches-remote = "!git branches refs/remotes"
branches-remote-origin = "!git branches refs/remotes/origin"
branches-remote-mine = "!git branches refs/remotes/origin/user/dilijev"
brr = branches-remote
bro = branches-remote-origin
brm = branches-remote-mine
#lbr = "!git branches-local | grep -Ev '\\s_'"
lbr = "!git branches-local | rg -v '\\s_'"
lbrv = "!git branches-local"
# ---
# ignoring files
# ---
ignore = update-index --assume-unchanged
unignore = update-index --no-assume-unchanged
ignored = !sh -c 'git ls-files -v | grep -E "^[a-z]"' # ls-files -v uses lowercase letters for files marked --assume-unchanged
chmodx = update-index --chmod=+x
[alias] # experimental scripted commands
## Figure out the original branch
tracking = !sh -c 'git rev-parse --abbrev-ref --symbolic-full-name $1@{u}'
# take the result of $(git tracking) and use sed to find just the name of the remote
# sed -e "s/\\/.*//" # match a literal '/' to the end of the line and replace with nothing
tracking-remote = !sh -c 'git tracking | sed -e s/[/].*//' $1
tr = !git tracking-remote
tracking-remote-branch = "!sh -c 'git tracking | sed -Ee \"s/[^/]*[/](.*)/\\1/\"' #" $1
tb = !git tracking-remote-branch
# fetch this branch from the tracking-remote, and then fast-forward the local branch
# ffp = "!sh -c 'git fetch $(git tracking-remote) $(git this); git merge --ff-only'"
ffp = "!sh -c 'git fetch $(git tracking-remote) $(git tracking-remote-branch); git merge --ff-only'"
fff = !git ffp
## Show changes only in the current branch
dt = !git diff $(git merge-base $(git tracking) HEAD)
## Show commits only in the current branch
lt = !git lg $(git tracking)..
## List all commits present in this branch that are not present in the named branch
# pending = !git lga $(git merge-base HEAD master)~..HEAD
pending = "!sh -c 'git lga $(git merge-base ${2:-origin/master} ${1:-$(git this)})~..${1:-$(git this)} #' $*"
pendingc = "!sh -c 'git -c core.pager=cat lga --pretty=crisp-cdate $(git merge-base ${2:-origin/master} ${1:-$(git this)})~..${1:-$(git this)} #' $*"
pend = !git pending
pm = "!git pending $(git this) origin/master"
pn = "!git pending $(git this) origin/main"
## List everyone who worked in this file or tree
authors = "!sh -c 'git log --pretty=\"%an <%ae>\" $* | sort | uniq #' $*"
authors-name-only = "!sh -c 'git log --pretty=\"%an\" $* | sort | uniq #' $*"
filetypes = "!sh -c 'git ls-files | sed -Ee \"s/.*([./][^/.]*)$/\\1/\" | sort | uniq' $*"
# refactor of merges above
merges1 = "!git rev-list $1..origin/master --merges --ancestry-path --reverse"
merges2 = "!git rev-list $1..$2 --merges --ancestry-path --reverse"
merges = "![ x$# != x1 ] && f() { git merges2 $1 $2; } || f() { git merges1 $1; }; f"
mergesf1 = "!git rev-list $1..origin/master --merges --ancestry-path --reverse --pretty=crisp --date=iso-local"
mergesf2 = "!git rev-list $1..$2 --merges --ancestry-path --reverse --pretty=crisp --date=iso-local"
mergesf = "![ x$# != x1 ] && f() { git mergesf2 $1 $2; } || f() { git mergesf1 $1; }; f"
gone = "!sh -c 'git branch -vv | rg \": gone\\]\" ' "
gone-name-only = "!sh -c 'git branch -vv | rg \": gone\\]\" | rg \"^\\s+user/\" | awk \"{ print \\$1 }\" ' "
[alias] # shorthand for master (m) and main (n) commands
# force (f) update branch (b) without switching (bf.)
bfm = !git fetch origin master && git branch -f master origin/master
bfn = !git fetch origin main && git branch -f main origin/main
# checkout (co.) master/main (m/n)
com = checkout master
con = checkout main
# checkout origin master/main fetch+force (co.f)
comf = !git fetch origin master && git checkout -B master origin/master
conf = !git fetch origin main && git checkout -B main origin/main
# rebase on origin master/main
rom = rebase origin/master
ron = rebase origin/main
# lf master/main
lfm = !git lf origin/master
lfn = !git lf origin/main
[pretty]
compact = %C(auto)[ %h ] %ad (%C(green dim)%an <%ae>%Creset%C(auto))%n %s%n
compact-nc = [%h] %ad (%an <%ae>)%n %s%n
crisp = [ %C(auto)%h ] %ad %C(green dim)%<(20,trunc)%ae%Creset%C(auto)%d %s
crisp-cdate = [ %C(auto)%h ] %ad %C(green dim)%<(20,trunc)%ae%Creset %C(yellow dim)|C:%Creset %cd %C(green dim)%<(10,trunc)%ce%Creset%C(auto)%d %s
crisp-nc = [ %h ] %ad | %<(20,trunc)%ae | %s # display crisp with no color formatting (to make it easier to read when saved to a file)
crisp-short = %C(auto)%h %C(green dim)%<(10,trunc)%ae%Creset%C(auto)%d %s
sweet = %C(auto)%h %C(green dim)%<(20,trunc)%ae%Creset%C(auto)%d %<(80,trunc)%s # same as crisp-short with truncation of the message to 80 char
brief = %C(auto)%h | %ad | %C(green dim)%<(7,trunc)%ae%Creset%C(auto) %<(40,trunc)%s # (80 columns) less emphasis on commit message; more on date, author, PR number
brief-nc = %h | %ad | %<(7,trunc)%ae %<(40,trunc)%s # (80 columns) less emphasis on commit message; more on date, author, PR number
summary = %ad %an %s
[push]
default = simple
# stuff that affects output of many git commands, possibly unexpectedly, best to leave it out in case this config is ported to another machine, and set these values on aliased commands instead
[format]
#pretty = compact
[log]
#date = format:"%Y-%m-%d %H:%M" # like ISO but no seconds or timezone
#date = format:"%Y-%m-%d %H:%M %z" # like ISO but no seconds (includes timezone %z")
#date = iso
[merge]
tool = kdiff3
### ======
### CONFIG
### ======
[core]
autocrlf = false
safecrlf = true
excludesfile = ~/gitignore_global.txt
preloadindex = true
fscache = true
editor = vim
whitespace = blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent
filemode = false
commitGraph = true
[credential "https://github.com"]
helper = !gh auth git-credential
[credential]
helper = store
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[commit]
gpgsign = false
[tag]
gpgsign = false
[gpg "x509"]
program = gitsign
[gpg]
format = x509
#interactive = never
#validate = false
#writelog = true
#helper = manager
[fetch]
showForcedUpdates = true
showForcedUpdatesWarning = false
[diff]
tool = bc
[difftool "bc"]
path = C:\\Program Files\\Beyond Compare 4\\BComp.exe
[difftool "odd"]
cmd = \"C:\\Program Files (x86)\\Odd\\Odd.exe\" $LOCAL $REMOTE
[merge]
tool = bc
[mergetool "bc"]
path = C:\\Program Files\\Beyond Compare 4\\BComp.exe
[mergetool "odd"]
path = C:\\Program Files (x86)\\Odd\\Odd.exe
# These aliases sometimes reference other aliases that are in my public .gitconfig file. See:
# https://github.com/dilijev/settings/blob/master/.gitconfig
[alias]
### GENERAL
## Configure any other branch (helpful when you want to fetch a branch not already configured above)
refspec-add = "!git remote set-branches --add origin $1* #"
[alias]
## Publish a branch as-named
bp = "!git push -u origin HEAD:$(git this) -f #"
bpd = "!git push origin :$(git this) #"
bpn = "!git push -u origin ${1:-__nobranch__}:${1:-__nobranch__} -f #"
bpdn = "!git push origin :${1:-__nobranch__} #"
## Publish a user branch for the current branch (or a named branch)
users-push = "!git push -u origin HEAD:users/dilijev/$(git this) -f #"
users-delete = "!git push origin :users/dilijev/$(git this) #"
uup = !git users-push
uud = !git users-delete
uupn = "!git push -u origin $1:users/dilijev/$1 -f #"
uudn = "!git push origin :users/dilijev/$1 #"
## Publish a user branch on VSO for the current branch (or a named branch)
user-push = "!git push -u origin HEAD:user/dilijev/$(git this) -f #"
user-delete = "!git push origin :user/dilijev/$(git this) #"
up = !git user-push
ud = !git user-delete
upn = "!git push -u origin $1:user/dilijev/$1 -f #"
udn = "!git push origin :user/dilijev/$1 #"
# git checkout your own VSO (origin) user branch with the given name
cuu = "!git fetch origin users/dilijev/$1; git checkout -B $1 origin/users/dilijev/$1 #"
cu = "!git fetch origin user/dilijev/$1; git checkout -B $1 origin/user/dilijev/$1 #"
# add a remote branch (from origin) and check it out with the same name
cb = "!git refspec-add $1; git fetch origin $1; git checkout -B $1 origin/$1 #"
fcb = "!git fetch origin $1; git checkout -B $1 origin/$1 #"
## Clean up all related branches (mnemonic: a = all)
# delete all associated instances of the current branch; don't try to delete the current branch (which we are on)
# ad = "!sh -c 'git bd; git ud; git pd; git rd'"
# delete all associated instances of the named branch; delete the current branch (will succeed if commit is merged in and we are not currently on that branch)
adn = "!sh -c 'git bdn $1; git udn $1; git pdn $1; git rdn $1; git branch -d $1' $*"
# ad = "!sh -c 'git bd 2>/dev/nul; git ud 2>/dev/nul; git pd 2>/dev/nul; git rd 2>/dev/nul'"
# adn = "!sh -c 'git bdn $1 2>/dev/nul; git udn $1 2>/dev/nul; git pdn $1 2>/dev/nul; git rdn $1 2>/dev/nul' $*"
me = log --first-parent --date=iso-local --pretty=crisp --author=doug.ilijev
me-nc = log --first-parent --date=iso-local --pretty=crisp-nc --author=doug.ilijev
gme = log --graph --date=iso-local --pretty=crisp --author=doug.ilijev
## List all branches that belong to me on all remotes (and ignore the rest of the branches which is mostly just noise to me)
branch-list = "!sh -c \"git branch; echo --; git branch -r | rg 'dilijev'\""
bl = !git branch-list
[branch]
autosetuprebase = always
[pull]
rebase = true
[init]
defaultBranch = main