-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitconfig
More file actions
405 lines (335 loc) · 12.9 KB
/
Copy pathgitconfig
File metadata and controls
405 lines (335 loc) · 12.9 KB
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
[user]
author = Yonatan Cohen
name = Yonatan Cohen
email = ycohen@habana.ai
# accepted values are two of
# normal, black, red, green, yellow, blue, magenta, cyan, white
# and optionally one of
# bold, dim, ul, blink and reverse
[color]
status = auto
branch = auto
diff = auto
[color "grep"]
linenumber = yellow bold
match = red
filename = magenta
[color "diff"]
meta = yellow
frag = magenta bold
old = red
new = blue
whitespace = magenta reverse
[color "status"]
added = yellow
changed = red
untracked = cyan
[alias]
# print the alias implementation
# git config --get-regexp alias.<alias name>
amendsources= commit --amend --no-edit
# amend = commit --amend --reuse-message=HEAD
amendcommitlog = commit --amend
amendauthor = commit --amend --author='Yonatan Cohen <ycohen@habana.ai>'
amenddatenow = git commit --amend --no-edit --date "$(date)"
amrej = am --reject
gog = log --abbrev-commit --name-status --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
b = branch -vv
ba = branch -avv
bdelete = branch -D
brename = branch -M
deleteremotebranch = "!f() { \
echo delete branch on the remote; \
echo : git push -d remote branch; \
\
echo other checkedout repo from this remote need to run; \
echo : git fetch -p ;\
}; f"
pushthisbranchtoremote = "!f() { \
if [ -z $1 ] ; then \
echo you must specify a remote; \
else \
git push -u $1 $(git rev-parse --abbrev-ref HEAD); \
fi; \
}; f"
pushthisbranchtoremotewithforce = "!f() { \
remote=${1:-origin}; \
git push --force ${remote} $(git rev-parse --abbrev-ref HEAD); \
}; f"
syncbranches = fetch -p
# print the name of the currently checked branch
bb = rev-parse --abbrev-ref HEAD
commitempty = commit --allow-empty
c = checkout
cb = checkout -b
# dg = difftool --tool=gvimdiff
# d = diff --color
d = diff
dw = diff --ws-error-highlight=all
dfile = difftool --no-prompt
dv = difftool
dc = diff --cached
dcv = difftool --cached
dt = difftool
ds = diff --stat
g = grep --color -n
gi = grep --color -n --ignore-case
h = log -n1 --pretty=oneline
listmodified = diff --name-only
listcached = diff --cached --name-only
mt = mergetool
mtv = mergetool --tool=vimdiff
r = remote -vv
s = "!f() { \
git track; \
git status -uno; \
}; f"
su = status -u
ss = show --stat
track = status -uno -sb
t = track
trackmaster = branch --set-upstream-to=origin/master
trackmasternext = branch --set-upstream-to=origin/master_next
tm = trackmaster
tmn = trackmasternext
trackbranch = "!f() { git branch --set-upstream-to=origin/$(git bb); \
echo tracking ; git t; }; f"
tb = trackbranch
unstage = reset HEAD
uncommit = reset HEAD^
saveheadindex = "!f() { \
git log -n1 --pretty=oneline | cut -d ' ' -f1 > reuse_commit.txt; \
}; f"
untrackfile = rm --cached
savework = "!f() { \
git commit -a -m 'save work'; \
}; f"
# if branch name is posixed with v<number>
# increment the version v<number++>
branchincversion = "!f() { \
v=$(git bb |grep -E -o "v[0-9]+$"); \
if [ -z $v ] ; then return ; fi ; \
v=$(echo $v | grep -E -o "[0-9]"); \
bnewname=$(git bb | sed 's/v[0-9]//'); \
v=$((v + 1)) ;\
git brename ${bnewname}v$v; \
};f "
checkoutmaster = "!f() { \
git fetch origin master; \
git checkout -b master FETCH_HEAD; \
}; f"
checkoutbranchfrommaster = "!f() { \
if [ -n $1 ] ; then \
git fetch origin master; \
git cb dev/ycohen/sw-$1 FETCH_HEAD; \
git branch --set-upstream-to=origin/master; \
git pull --rebase; \
fi; \
}; f"
dg = "!f() { \
if [ -z $1 ] ; then \
git difftool --tool=gvimdiff; \
else \
git difftool --tool=gvimdiff --no-prompt $1; \
fi; \
}; f"
a = "!f() { \
if [ -z $1 ] ; then \
git add -u ; \
else \
git add $1 ; \
fi; \
}; f"
push-commit = "!f() { \
if [ -z $1 ] ; then \
git push origin HEAD:master;\
else \
git push orign $1:master; \
fi; \
}; f"
# listtrackedfiles = ls-tree --name-only -r
listtrackedfiles = "!git ls-files"
# discardall = checkout HEAD -- .
discard = "!f() { \
if [ -z $1 ] ; then \
git checkout HEAD -- . ; \
else \
git checkout $1 ; \
fi; \
}; f"
# SHA date name msg
lll = log --pretty=format:'%C(yellow)%h %Cred%ad %>(10,trunc) %Cblue%an%Cgreen%d %Creset%s'
l = log --pretty=format:'%C(yellow)%h %Cred%ad %>(10,trunc) %Cblue%an%Cgreen%d %Creset%s' --date=short
lyoni = log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=short --author='Yonatan Cohen'
l10 = log --pretty=format:'%C(yellow)%h %Cred%ad %>(10,trunc) %Cblue%an%Cgreen%d %Creset%s ' --date=short -n10
l20 = log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s ' --date=short -n20
l30 = log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s ' --date=short -n30
lf = log --pretty=short
gl = log --graph --full-history --all --color --pretty=format:%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s
gls = log --graph --full-history --all --color --pretty=format:%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s --simplify-by-decoration
lnameonly = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
diffnameonly = "!f() { git show $1 |diffstat -p1 -l; }; f"
# also can track changes to file with tig -- <file>
logfilehistory = whatchanged --pretty=format:'%C(yellow)%h %Cred%ad %>(10,trunc) %Cblue%an%Cgreen%d %Creset%s' --date=short
# diffcommit = "!f() { git difftool $1^..$1 --tool=gvimdiff; }; f"
diffcommit = "!f() { \
if [ -z $1 ] ; then \
git difftool HEAD^..HEAD --prompt; \
else \
git difftool $1^..$1 --prompt; \
fi ; \
}; f"
diffcommitfile = "!f() { \
if [ $# -eq 1 ] ; then \
git difftool HEAD^..HEAD -y $1 ; \
else \
git difftool $1^..$1 -y $2; \
fi; \
}; f"
difffilebetweenbranches = "!f() { \
branchA=$1; \
branchB=$2; \
file=$3; \
git dt $branchA $branchB -- $file; \
}; f"
format-patch-commit = "!f() { \
if [ $# -eq 0 ] ; then \
git format-patch HEAD^..HEAD ; \
else \
git format-patch $1^..$1 ; \
fi; \
}; f"
cherry-pick-commit = "!f() { \
if [ $# -gt 0 ] ; then \
git cherry-pick $1^..$1 ; \
fi; \
}; f"
edit = "!f() { \
if [ $# -eq 0 ] ; then \
git commit --amend ; \
else \
GIT_EDITOR=~/yonienv/bin/gitedit.sh git rebase -i $1^; \
fi \
}; f"
# list only untracked files
lu = ls-files --others
lgraph = !git lg1
lg1 = !git lg1-specific --all
lg2 = !git lg2-specific --all
lg3 = !git lg3-specific --all
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim red)- %an%C(reset)%C(yellow)%d%C(reset)'
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
rlog = log --show-notes=review
rebaseto = "!f() { git rebase -i $1^; }; f"
commitfilelist = show --stat --oneline
sl = stash list
pushlist = "!f() { \
if [ $# -gt 0 ] ; then \
echo git diff --stat --cached $1/$2 ; \
git diff --stat --cached $1/$2 ; \
else \
echo git diff --stat --cached origin/master ; \
git diff --stat --cached origin/master ; \
fi; \
}; f"
cleanuntracked = "!f() { git ls-files --others | xargs rm --interactive=once;}; f"
# cleanuntracked = clean -df
# branch-upstream-kernel-rdma-next-mlx = "!f() { git fetch origin rdma-next-mlx ; git c -b $1@rdma-next-mlx FETCH_HEAD ; }; f"
# rebase-upstream-kernel-rdma-next-mlx = "!f() { git fetch origin rdma-next-mlx ; git rebase FETCH_HEAD ; }; f"
# branch-rdmacore-for-upsteam = "!f() { git fetch origin for-upstream ; git c -b $1@for-upstream FETCH_HEAD ; }; f"
# rebase-rdmacore-for-upsteam = "!f() { git fetch origin for-upstream ; git rebase FETCH_HEAD ; }; f"
# branch-ofa-kernel-4-6 = "!f() { if [ -z $1 ] ; then return ; fi; git fetch origin mlnx_ofed_4_6 ; git c -b $1@mlnx_ofed_4_6 FETCH_HEAD ; }; f"
# rebase-ofa-kernel-4-6 = "!f() { git fetch origin mlnx_ofed_4_6 ; git rebase FETCH_HEAD ; }; f"
[core]
editor = vim
[diff]
tool = gvimdiff
[merge]
tool = gvimdiff
[difftool]
prompt = true
[commit]
# template = ~/share/yonienv/git_commit_template
[credential]
helper = cache
[push]
default = simple
[core]
whitespace = trailing-space,space-before-tab,indent-with-non-tab
[gc]
autoDetach = false
[grep]
linenumber = true
[sendemail]
# smtpserver = /usr/local/bin/msmtp-enqueue.sh
suppresscc = self
signedoffbycc = true
cccover = true
tocover = true
chainReplyTo = false
confirm = always
from = Yonatan Cohen <yonatanc@mellanox.com>
envelopeSender = Yonatan Cohen <yonatanc@mellanox.com>
signingkey = yonatanc@mellanox.com
[gpg]
program = gpg2
#
# all sorts of aliases.
#
# commityoni = "!f() { \
# git config commit.template ~/share/yonienv/git_commit_template_yonic; \
# git commit; \
# }f"
# commitmlx = "!f() { \
# git config commit.template ~/share/yonienv/git_commit_template; \
# git commit; \
# }f"
#
# l = log --pretty=format oneline
# l10 = log --pretty=oneline -n10
# l30 = log --pretty=oneline -n30
# ll = log --pretty=oneline --graph --decorate --abbrev-commit
# ll = log --graph --decorate --pretty=format:"%h %an, %ar - %s"
# ll = log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=short
#
# diffcommitfile = "!f() { git difftool $1^..$1 --tool=gvimdiff $2;}; f"
#
#
#
#
# l = "!f() { \
# if [ -z $1 ] ; then \
# git log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=short; \
# else \
# git log -n $1 --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=short; \
# fi ; \
# }; f"
#
#
# lyoni = log --pretty=oneline --date=short --author='Yonatan Cohen'
#
# ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
# ls = log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=short
[pull]
rebase = true
[http]
postBuffer = 524288000
[credential]
helper = cache
[tig "bind"]
generic = D !git dt --no-prompt %(commit)^ %(commit)
main = w !git difftool %(commit)^!
diff = w !git difftool --tool=vimdiff %(commit)^!
# main = = !git commit --fixup=%(commit)
# main = <ctrl-r> !git rebase --autosquash -i %(commit)
[tig]
# main-view-date = custom
# main-view-date-format = "%Y-%m-%d-%H:%M"
# main-view-date-display = relative-compact
# main-view-commit-title-graph = v1
main-view-author-display = abbreviated
main-view-id-display = yes
vertical-split = yes
mouse = yes
blame-view-line-number = yes