-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
329 lines (277 loc) · 13.8 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
[user]
name = Jan Krag
email = [email protected]
signingKey = 3153E6FCA7C3F153
[core]
excludesfile = /Users/jankrag/.gitignore_global
quotepath = off
precomposeunicode = true
autocrlf = input
pager = less -F -X
#whitespace = cr-at-eol
#safecrlf = true
[credential]
helper = osxkeychain
[mergetool "p4merge"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge $PWD/$BASE $PWD/$REMOTE $PWD/$LOCAL $PWD/$MERGED
trustExitCode = false
[merge]
tool = p4merge
[mergetool]
keepBackup = false
[mergetool "meld"]
# Choose one of these 2 lines (not both!)
cmd = meld "$LOCAL" "$MERGED" "$REMOTE" --output "$MERGED"
# cmd = meld "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED"
[mergetool "kdiff3"]
cmd = kdiff3 #$BASE $LOCAL $REMOTE -o $MERGED
trustExitCode = false
[difftool "kdiff3"]
cmd = kdiff3
trustExitCode = false
[difftool "delta"]
cmd = delta
trustExitCode = false
[diff]
tool = kdiff3
[mergetool "bc4"]
trustExitCode = true
[alias]
thierry-pick = cherry-pick
# fetch and show what would be merged (use option "-p" to see patch)
incoming = "!git remote update -p; git log ..@{u}"
in = incoming
inlog = slog @{u}
# what would be pushed (currently committed); see also alias difr
outgoing = log @{u}..
out = log @{u}..
sout = log --pretty=format:'%C(auto)%h %C(red)%ad %C(blue)%aN%C(auto)%d %C(reset)%s' --date=short @{u}..
s = status
st = status
ss = status -sb
rawst = !git status --porcelain | grep '^ . '
sw = switch
rmbranch = "!f(){ git branch -d ${1} && git push origin --delete ${1}; };f"
slog = log --pretty=slog
ls = log --pretty=format:%C(auto)%h%C(auto)%d\\ %Creset%s%Cblue\\ [%cn]
ll = log --pretty=format:%C(auto)%h%C(auto)%d\\ %Creset%s%Cblue\\ [%cn] --numstat
sum = log --pretty=format:'Commit: %C(auto)%h %d%n%C(reset)Parents: %C(auto)%p%C(reset)%nAuthor: %aN <%ae>%nMessage: %s%n%b' -1
slogbw = log --pretty=format:'%h %ad %an%d %s' --date=short --decorate
glog2 = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%aN>%Creset' --abbrev-commit
glog = log --graph --pretty=format:'%C(auto)%h %C(red)%ad %C(blue)%aN%C(auto)%d %C(reset)%s' --date=short --all
glogdemo = log --graph --pretty=format:'%C(auto)%h %C(blue)%aN%C(auto)%d %C(reset)%<(30,trunc)%s' --decorate=short --all --color
glogdemo2 = log --graph --pretty=format:'%C(yellow)%h %Cblue%aN%Cgreen%d %Creset' --decorate=short --all --color
#glog = log --graph --oneline --abbrev-commit --all --decorate
wdiff = diff -w --word-diff=color --ignore-space-at-eol
remotebranch = rev-parse --symbolic-full-name --abbrev-ref @{u}
cbranch = rev-parse --abbrev-ref HEAD
curbranch = symbolic-ref --short HEAD
#branches = "for-each-ref --sort=-committerdate --format='%1B[32m%(committerdate:iso8601) %1B[34m%(committerdate:relative) %1B[0;m%(refname:short)' refs/heads/"
branches = "for-each-ref --sort=-committerdate --format='%1B[32m%(committerdate:iso8601) (%(committerdate:relative)) %1B[34m%(refname:short) %1B[32m<- %1B[31m%(upstream:short)%1B[0;m %1B[32m [%(objectname:short)] %1B[0;m' refs/heads/"
remotebranches = "for-each-ref --sort=-committerdate --format='%1B[32m%(committerdate:iso8601) (%(committerdate:relative)) %1B[34m%(objectname:short) %1B[32m<- %1B[31m%(refname:short)%1B[0;m' refs/remotes/"
last = show -s HEAD^{commit}
lastm = !git last | tail -n+5 | sed -e 's/^[ \t]*//'
lastpb = !git lastm | perl -ne 'chomp and print' | pbcopy
gg = grep --extended-regexp --line-number
rblame = !sh -c 'while line=$(git blame $@ $commit 2>/dev/null) ; do commit=${line:0:8}^; [ 00000000^ == $commit ] && commit=$(git rev-parse HEAD); echo $line; done' dumb_param
oldest-ancestor = !zsh -c 'diff -u <(git rev-list --first-parent ${1:-master}) <(git rev-list --first-parent ${2:-HEAD}) | sed -ne \"s/^ //p\" | head -1' -
branchroot = diff -u <(git log --pretty=oneline branch_A) <(git log --pretty=oneline master) | tail -1 | cut -c 2-42
# http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
# what changed in last command (e.g. pull)
new = !sh -c 'git log $1@{1}..$1@{0} $@'
# Show modified files in last commit
dl = !git ll -1
#Show a diff last commit:
dlc = diff --cached HEAD^
#list all defined aliases
aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\t=> \\2/' | sort
aliases2 = config --get-regexp alias
# create a git repo including everything in this dir
initthis = !git init && git add . && git commit -m \"Bootstrap commit\"
# init new git repo with empty initial commit
start = !git init && git commit --allow-empty -m \"Initial commit\"
l = log --pretty=slog
l1 = l -1
l5 = l -5
l10 = l -10
l20 = l -20
# l1 = !git log -1 --pretty=format:'%C(auto)%h %Cred%ad %Cblue%aN%Cgreen%d %Creset%s' --date=short --decorate
# l5 = !git log -5 --pretty=format:'%C(auto)%h %Cred%ad %Cblue%aN%Cgreen%d %Creset%s' --date=short --decorate
# l10 = !git log -10 --pretty=format:'%C(auto)%h %Cred%ad %Cblue%aN%C(auto)%d %Creset%s' --date=short --decorate
# l20 = !git log -20 --pretty=format:'%C(auto)%h %Cred%ad %Cblue%aN%C(auto)%d %Creset%s' --date=short --decorate
tree = log --all --graph --decorate=short --color --format=format:'%C(bold blue)%h%C(reset) %C(auto)%d%C(reset)\n %C(auto)[%cr]%C(reset) %x09%C(auto)%aN: %s %C(reset)'
logx = log --all --graph --decorate=short --color --format=format:'%C(bold blue)%h%C(reset)+%C(dim black)(%cr)%C(reset)+%C(auto)%d%C(reset)++\n+++ %C(bold black)%aN%C(reset)%C(black): %s%C(reset)'
exportalias = "!f() { in=${1}; out=$(git config --get alias.$in) ; printf 'git config --global alias.%s %q\n' $in \"$out\";};f"
continue = "! \
f() { \
repo_path=$(git rev-parse --git-dir); \
if [ $? -ne 0 ]; then exit $?; fi; \
if [ -d \"${repo_path}/rebase-merge\" ]; then git rebase --continue; \
elif [ -d \"${repo_path}/rebase-apply\" ]; then git rebase --continue; \
elif [ -f \"${repo_path}/MERGE_HEAD\" ]; then git merge --continue; \
elif [ -f \"${repo_path}/CHERRY_PICK_HEAD\" ]; \
then git cherry-pick --continue; \
elif [ -f \"${repo_path}/REVERT_HEAD\" ]; then git revert --continue; \
else echo \"Nothing to continue?\"; \
fi; \
}; \
f"
cm = commit -m
amend = commit --amend
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
#safereset = !git commit -av -m "SAFE_RESET - `date`" && git reset --hard HEAD~1
orphank = !gitk --all `git reflog | cut -c1-7`&
orphanl = !git log --pretty=oneline --abbrev-commit --graph --decorate `git reflog | cut -c1-7`
co = checkout
panic = !PD=$(date +%d%m%y-%H%M) && git add -A && git commit -mWAAAAAAAAGH!! && git checkout -B PANIC-$USER-$PD && git push -f origin PANIC-$USER-$PD
drunk = !PD=$(date +%d%m%y-%H%M) && git add -A && git commit -mIs this brilliant.... or not??? && git checkout -B $USER-WAS-DRUNK-$PD && git push -f origin $USER-WAS-DRUNK-$PD
wshow = show -w --word-diff=color --ignore-space-at-eol
cleanup = phlow cleanup
# Which files are receiving the most "love" (http://michaelwales.com/articles/make-gitconfig-work-for-you/)
churn = !git log --all -M -C --name-only --format='format:' $@ | sort | grep -v '^$' | uniq -c | sort -r | awk 'BEGIN {print count,file} {print $1 , $2}' | less -X -F
# Thin out older metadata within the repository, reduces filesystem footprint
trim = !git reflog expire --expire=now --all && git gc --prune=now
first = rev-list --max-parents=0 HEAD
cfp = cat-file -p
forget = rm --cached
structurelog = slog --simplify-by-decoration --graph --all --tags
continu2 = "!f() { repo_path=$(git rev-parse --git-dir); if [ $? -ne 0 ]; then exit $?; fi; if [ -d \"${repo_path}/rebase-merge\" ]; then git rebase --continue; elif [ -d \"${repo_path}/rebase-apply\" ]; then git rebase --continue; elif [ -f \"${repo_path}/MERGE_HEAD\" ]; then git merge --continue; elif [ -f \"${repo_path}/CHERRY_PICK_HEAD\" ]; then git cherry-pick --continue; elif [ -f \"${repo_path}/REVERT_HEAD\" ]; then git revert --continue; else echo \"No something in progress?\" ;fi;};"
lome = "!git slog --author=\"$(git config --get user.name)\""
mycommits = slog --author=\".*[Jj]an\\s*[Kk]rag.*\"
# git status using pager
pst = -c core.pager=less -p status
# Verbose commit (add diff to comments in commit text)
vcommit = -c commit.verbose=true commit
# Switch to master/main whatever branch
swm = !git switch $(basename $(git symbolic-ref --short refs/remotes/origin/HEAD))
# Delete all branches merged into master. With -f also include branches merged into current
sweep = !git branch --merged $([[ $1 != \"-f\" ]] \\\n&& git rev-parse master) | egrep -v \"(^\\*|^\\s*(master|develop)$)\" \\\n| xargs git branch -d
# Show diff for all untracked files
udiff = "!f() { for next in $( git ls-files --others --exclude-standard ) ; do git --no-pager diff --no-index /dev/null $next; done;}; f"
#remoteurl="remote get-url origin"
#remotehttp="!git remoteurl | sed -e 's/git@/https:\\/\\//'"
open = "!f(){ open `git remote -v | awk '/fetch/{print $2}' | sed -Ee 's#(git@|git://)#http://#' -e 's@com:@com/@'`| head -n1; }; f"
open2 = "!f() { \
open `git remote -v \
| awk '/fetch/{print $2}' \
| sed -Ee 's#(git@|git://)#http://#' -e 's@com:@com/@'` \
| head -n1; \
}; \
f"
cat = cat-file -p
cats = cat-file -s
catt = cat-file -t
#git = "!git"
rootstatus = "!git status"
sr = "!git status"
drlambda = "!git rev-parse HEAD > .git/refs/heads/lambda && git switch lambda"
ghremote = "!f() { \
git remote add $1 https://github.com/$2.git; \
}; f"
mm = "!git log --format='%aN <%aE>' | sort -u"
mmm = "!git log --format='%aN <%aE>' | sort -u > .mailmap"
mmme = "!git log --format='%aN <%aE>' | sort -u > .mailmap && code .mailmap"
watchshort = "!watch -t git shortlog -sn"
watchshorthouse = "!watch -t git shortlog -sn -- house.txt"
watchhouse = "!watch -t cat house.txt"
serve = daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/
# Run git serve. Git says "Ready to rumble"
# Others can now:
# git clone git://<myIP>/
# or
# git fetch git://<myIP>/
# https://gist.github.com/RichardBronosky/9af3b9796d7423cd0e8e1d419fcea9fc
pushfl = push --force-with-lease
pleasepush = pushfl
git = !git
[pretty]
#color
# The value for a variable that takes a color is a list of colors (at most two, one for foreground and one for background) and attributes (as many as you want), separated by spaces.
# The basic colors accepted are normal, black, red, green, yellow, blue, magenta, cyan, white and default. The first color given is the foreground; the second is the background. All the basic colors except normal and default have a bright
# variant that can be specified by prefixing the color with bright, like brightred.
# The color normal makes no change to the color. It is the same as an empty string, but can be used as the foreground color when specifying a background color alone (for example, "normal red").
# The color default explicitly resets the color to the terminal default, for example to specify a cleared background. Although it varies between terminals, this is usually not the same as setting to "white black".
# Colors may also be given as numbers between 0 and 255; these use ANSI 256-color mode (but note that not all terminals may support this). If your terminal supports it, you may also specify 24-bit RGB values as hex, like #ff0ab3.
# The accepted attributes are bold, dim, ul, blink, reverse, italic, and strike (for crossed-out or "strikethrough" letters). The position of any attributes with respect to the colors (before, after, or in between), doesn’t matter. Specific
# attributes may be turned off by prefixing them with no or no- (e.g., noreverse, no-ul, etc).
# The pseudo-attribute reset resets all colors and attributes before applying the specified coloring. For example, reset green will result in a green foreground and default background without any active attributes.
dateline = format:%C(yellow)%h%Creset%x09%Cred%<(13)%an%Creset%x09%Cblue%as%Creset%x09%s
bw=format:%h | %as | %<(15,trunc)%an %>>(20,trunc)%d%x09%s
glog=format:%C(yellow)%h %Cred%as %Cblue%an%Cgreen%d %Creset%s
glog2=format:%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset
slog = format:%C(yellow)%h %C(red)%as %C(blue)%aN%C(auto)%d %Creset%s
lome = log --author=\"jankrag\"
[color]
ui = true
[diff]
wordregex = [[:alnum:]]+|[^[:space:]]
guitool = kdiff3
[color "diff"]
# new = cyan bold
# meta = yellow bold
# frag = magenta bold
# old = red bold
# new = green bold
[color "status"]
# added = yellow
# changed = blue
# untracked = red
[color "branch"]
# current = yellow reverse
# local = yello
# remote = green
[diff "xlsconv"]
textconv = xls2csv
[diff "pdfconv"]
textconv = pdftohtml -stdout
[diff "docconv"]
textconv = catdoc
[diff "pandoc2md"]
textconv = pandoc --to=markdown
[diff "zip"]
textconv = unzip -c -a
[diff "exif"]
textconv = exiftool
cachetextconv = true
[diff "jpg"]
textconv = jp2a --width=80
cachetextconv = true
[achievement]
upload = true
[push]
default = simple
[rerere]
autoupdate = true
[github]
user = JKrag
[ghi]
token = !security find-internet-password -a JKrag -s github.com -l 'ghi token' -w
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
# http://michaelwales.com/articles/make-gitconfig-work-for-you/
# Allows: git clone gh:JKrag/GittingIt
[url "https://github.com/"]
insteadOf = gh:
[url "https://github.com/eficode-academy/"]
insteadOf = ghea:
[url "https://github.com/jkrag/"]
insteadOf = jkrag:
[url "https://github.com/eficode-academy/git-katas.git"]
insteadOf = gk:
[url "https://gist.github.com/"]
insteadOf = gist:
[url "https://bitbucket.org/"]
insteadOf = bb:
[gc]
[protocol]
version = 2
[uploadpack]
allowFilter = true
[init]
defaultBranch = master
[credential "https://dev.azure.com"]
useHttpPath = true
[diff "daff-csv"]