-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitconfig
318 lines (261 loc) Β· 8.02 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
; vim: ft=gitconfig
[commit]
verbose = true
# gpgsign = true
[init]
# requires Git 2.28 or later
defaultBranch = main
[user]
useconfigonly = true
# use separate file for username / github token / etc
[includeIf "gitdir:~/iKas/"]
path = ~/.gitconfig.ikas
[includeIf "gitdir:~/Projects/Polestar/"]
path = ~/.gitconfig.polestar
[includeIf "gitdir:~/"]
path = ~/.gitconfig.local
[gpg]
program = /usr/local/bin/gpg
[core]
editor = $EDITOR
commitGraph = true
whitespace=fix,space-before-tab,tab-in-indent,trailing-space,cr-at-eol
; https://git-scm.com/docs/git-update-index#_untracked_cache
excludesfile = ~/.config/git/.gitignore
attributesfile = ~/.config/git/.gitattributes
untrackedCache = true
; hash (#) conflicts with Markdown when I use hb to open PRs etc...
commentChar = %
pager = delta_
[interactive]
diffFilter = delta_ --color-only --features=interactive
[add.interactive]
useBuiltin = false # required for delta with git 2.37.0
[delta]
syntax-theme = none
navigate = true # use n and N to move between diff sections
hyperlinks = true
file-modified-label = MODIFIED:
file-removed-label = REMOVED:
file-added-label = ADDED:
file-renamed-label = RENAMED:
features = labels decorations
[delta "decorations"]
whitespace-error-style = 22 reverse
zero-style = 8
commit-decoration-style = bold yellow box
hunk-header-style = 8
hunk-header-decoration-style = black box
file-style = yellow italic
file-decoration-style = none
minus-style = strike 088
minus-emph-style = 001 052
plus-style = italic 034
plus-emph-style = italic black 034
line-numbers-zero-style = 235
line-numbers-minus-style = 088
line-numbers-plus-style = 034
[alias]
# branches = "!git branch -a | sed -n '/\/HEAD /d; /\/main$/d; /remotes/p;' | xargs -L1 git checkout -t"
addall = !sh -c 'git add . && git add -u'
amend = commit --amend --no-edit --date now
blm = blame -wMC
br = branch -vv --sort=-committerdate --format='%(HEAD) %(color:red)%(objectname:short)%(color:reset) %(if:equals=*)%(HEAD)%(then)%(color:cyan)%(end)%(align:15,left)%(refname:short)%(end)%(color:reset)%(align:21,left)%(color:green)%(committerdate:auto:human)%(color:reset)%(end)%(contents:subject)'
brs = br -a
cb = checkout -b
cm = commit
co = checkout
d = diff --patch-with-stat
dc = d --staged
dm = d --word-diff-regex=.
doctor = remote -v show origin
track = push origin -u HEAD
force = push --force-with-lease
hidden = !git ls-files -v | grep \"^[a-z]\"
hide = update-index --assume-unchanged
l = log --color=always --graph --pretty=format:\"%C(blue)%h %Creset- %C(green)(%cr) %Creset%s - %C(cyan)%aN %C(magenta)%d\" --date=auto:human
lf = l --numstat
la = l --all --simplify-by-decoration
lastchange = log -p --follow -n 1
publish="!git push -u origin $(git branch-name)"
stashes = stash list
save = stash save -u
unhide = update-index --no-assume-unchanged
unpublish="!git push origin :$(git branch-name)"
who = shortlog -sne
# Undo
undo= reset HEAD~ # Undo commit and unstage all files
undosoft= reset --soft HEAD~ # Undo commit and keep all files staged
undohard= reset --hard HEAD~ # Undo the commit and completely remove all changes
undopush= push -f origin HEAD^:master
unstage = reset HEAD --
# Rename branch name local & remote. Usage: $ git rename old_branch new_branch, and it's done.
rename = "!change() { git branch -m $1 $2; git push origin :$1; git push --set-upstream origin $2; }; change"
# list commited files name, Usage: $ git cf <COMMIT_ID>
cf = "!show_commited_files() { git diff-tree --no-commit-id --name-only -r $1; }; show_commited_files"
# Review helpers: https://blog.jez.io/cli-code-review/
# https://github.com/jez/dotfiles/blob/d7b720fe13b6bc83829d248e23127b918d65de6e/util/gitconfig#L23-L53
review-base = !git merge-base HEAD \"${review_base:-master}\"
stat = !git --no-pager diff --stat $(git review-base)
files = !git --no-pager diff --name-only $(git review-base)
# Review by commit
by-commit = !tig log --reverse $(git review-base)..HEAD
# Show a markdown-formatted summary of commits from {review_base:-master} until HEAD
pr-summary = !git log --reverse --format=\"- **%s** (%h)%n%n%w(74,2,2)%b\" \"${review_base:-master}\"..HEAD
# split-diff style review using vim-fugitive Gdiff
review = !$EDITOR -p $(git files) +\"tabdo Gdiff ${review_base:-master}\"
reviewone = !$EDITOR -p +\"tabdo Gdiff ${review_base:-master}\"
reviewf = !$EDITOR -p $(git files | fzf) +\"tabdo Gdiff ${review_base:-master}\"
# Show just the subject and body of a particular commit (default: HEAD)
message = log -n1 --format=\"%s%n%n%b\"
# Get last commit authored by me
my-last = log -n1 --format=\"%H\" --author=\"\\([aA]hmet\\)\\|\\([jJ]acob\\) [aA]bdulrahman\"
# Git Commit, Add all and Push β in one step.
cap = "!f() { git add .; git commit -m \"$@\"; git push; }; f"
# NEW.
new1 = "!f() { git cap \"π¦ $@\"; }; f"
# IMPROVE.
imp = "!f() { git cap \"π $@\"; }; f"
# FIX.
fix = "!f() { git cap \"π $@\"; }; f"
# RELEASE.
rlz = "!f() { git cap \"π $@\"; }; f"
# DOC.
doc = "!f() { git cap \"π $@\"; }; f"
# TEST.
tst = "!f() { git cap \"β
$@\"; }; f"
[branch]
autosetupmerge = always
autosetuprebase = always
[branch "main"]
rebase = true
[branch "master"]
rebase = true
[fetch]
prune = true
fsckObjects = true
# [pager]
# show-branch = true
# status = true
# so much color
[color]
ui = true
[color "diff"]
meta = 238 italic
frag = 240
old = red strike
new = green italic
whitespace = red reverse
commit = yellow bold
[color "diff-highlight"]
oldNormal = red strike
oldHighlight = red strike 52
newNormal = green italic
newHighlight = green italic 22
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "status"]
added = green
changed = yellow
untracked = red
# git mergetool
[merge]
# Include summaries of merged commits in newly created merge commit messages
log = 1000
tool = vimdiff
conflictstyle = diff3
[mergetool]
trustExitCode = true
keepBackup = false
prompt = false
[mergetool "vimdiff"]
cmd = $EDITOR -d $LOCAL $BASE $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'
[mergetool "fugitivediff"]
cmd = $EDITOR -f -c "Gdiff" "$MERGED"
# URL shorthands
[url "[email protected]:"]
insteadOf = "gh:"
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
insteadOf = https://github.com/
[url "git://github.com/"]
insteadOf = "github:"
[url "[email protected]:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
[url "git://gist.github.com/"]
insteadOf = "gist:"
[url "[email protected]:"]
insteadOf = gl:
pushInsteadOf = gitlab:
pushInsteadOf = git://gitlab.com/
[url "git://gitlab.com/"]
insteadOf = gitlab:
[url "[email protected]:"]
insteadOf = bb:
pushInsteadOf = bitbucket:
pushInsteadOf = git://bitbucket.org/
[url "git://bitbucket.org/"]
insteadOf = bitbucket:
# correct typos
[help]
autocorrect = 1
# push easily. http://stackoverflow.com/a/23918418/89484
[push]
default = simple
followTags = true
[pull]
rebase = true
[fetch]
prune = true
[rebase]
autosquash = true
instructionFormat = [%cn <%ce> %G?] %s
autoStash = true
[filter "media"]
clean = git-media-clean %f
smudge = git-media-smudge %f
[receive]
fsckObjects = true
[diff]
compactionHeuristic = true
# Show blocks of moved text of at least 20 alphanumeric characters differently than adds/deletes
# https://blog.github.com/2018-04-05-git-217-released/
colorMoved = zebra
# Detect copies as well as renames
renames = copies
algorithm = histogram
tool = vimdiff
indentHeuristic = true
[difftool]
prompt = false
trustExitCode = true
[difftool "vimdiff"]
cmd = $EDITOR -d $LOCAL $REMOTE
[stash]
showPatch = true
[log]
decorate = short
date = local
[status]
submodulesummary = true
color = true
[submodule]
recurse = true
[tag]
forceSignAnnotated = true
[apply]
whitespace = nowarn
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[protocol]
version = 2 # Added in Git 2.18.0.
[protocol "keybase"]
allow = always
[diff-so-fancy]
first-run = false