-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
314 lines (300 loc) · 10.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
[alias]
b = branch
; ba = branch -a
; bd = branch -D
; bnc = branch --no-color
c = commit
; ca = commit --amend # --no-edit
chp = cherry-pick
cleaner = !git branch --merged master --no-color | grep -v '^[ *]*master$' | xargs git branch -d
co = checkout
cob = checkout -B # switch to a branch, creating it if necessary
# format -> default/ original time zone (either committer’s or author’s)
# format-local -> user's local timezone instead
ll = log --decorate --date=short --pretty=format:'%C(magenta)%h%Creset %C(bold black)%ad%C(reset)%C(auto) %s %C(blue)%an%C(auto) %D%C(reset)'
l = ll --topo-order -30 --pretty=format:'%C(magenta)%h%Creset %C(yellow)%ad%C(reset)%C(auto) %s %C(blue)%an%C(auto) %D%C(reset)'
#l = ll --topo-order -30 --pretty=format:'%C(magenta)%h%Creset %C(yellow)%ad%C(reset)%C(auto) %s %C(blue)%an %C(bold black)%D%C(reset)' pmr = push -o merge_request.create -o merge_request.merge_when_pipeline_succeeds # push MR
mt = mergetool
reb = !"r() { git rebase --autosquash -i HEAD~$1; }; r" # Interactive rebase with the given number of latest commits
ss = status --short
wip = !"wip() { git add .; git commit -a -m '--wip-- [ci skip]' --no-verify; }; wip" # basically an immediate commit that u want in you reflog
wipr = !"wipr() { git reset --soft HEAD~; git reset ; }; wipr" # undo last commit (works well with gwip) - watch out though
a = "!f() { \
if [[ $# -eq 0 || \"$1\" == \".\" ]]; then \
git add .; \
else \
files_to_add=(); \
for arg in $(seq $(git status --porcelain | wc -l)); do \
files_to_add+=($(git status --porcelain | sed -n ${arg}p | awk '{print $2}')); \
done; \
if [[ $1 == *'-'* ]]; then \
IFS='-' read -ra RANGE <<< \"$1\"; \
for i in $(seq ${RANGE[0]} ${RANGE[1]}); do \
git add \"${files_to_add[$i-1]}\"; \
done; \
elif [[ $1 == *','* ]]; then \
IFS=',' read -ra NUMS <<< \"$1\"; \
for i in \"${NUMS[@]}\"; do \
git add \"${files_to_add[$i-1]}\"; \
done; \
else \
git add \"${files_to_add[$1-1]}\"; \
fi; \
fi; \
}; f"
ap = "!f() { \
if [[ $# -eq 0 || \"$1\" == \".\" ]]; then \
git add -p .; \
else \
files_to_add=(); \
for arg in $(seq $(git status --porcelain | wc -l)); do \
files_to_add+=($(git status --porcelain | sed -n ${arg}p | awk '{print $2}')); \
done; \
if [[ $1 == *'-'* ]]; then \
IFS='-' read -ra RANGE <<< \"$1\"; \
for i in $(seq ${RANGE[0]} ${RANGE[1]}); do \
git add -p \"${files_to_add[$i-1]}\"; \
done; \
elif [[ $1 == *','* ]]; then \
IFS=',' read -ra NUMS <<< \"$1\"; \
for i in \"${NUMS[@]}\"; do \
git add -p \"${files_to_add[$i-1]}\"; \
done; \
else \
git add -p \"${files_to_add[$1-1]}\"; \
fi; \
fi; \
}; f"
r = "!f() { \
if [[ $# -eq 0 || \"$1\" == \".\" ]]; then \
git reset .; \
else \
files_to_add=(); \
for arg in $(seq $(git status --porcelain | wc -l)); do \
files_to_add+=($(git status --porcelain | sed -n ${arg}p | awk '{print $2}')); \
done; \
if [[ $1 == *'-'* ]]; then \
IFS='-' read -ra RANGE <<< \"$1\"; \
for i in $(seq ${RANGE[0]} ${RANGE[1]}); do \
git reset \"${files_to_add[$i-1]}\"; \
done; \
elif [[ $1 == *','* ]]; then \
IFS=',' read -ra NUMS <<< \"$1\"; \
for i in \"${NUMS[@]}\"; do \
git reset \"${files_to_add[$i-1]}\"; \
done; \
else \
git reset \"${files_to_add[$1-1]}\"; \
fi; \
fi; \
}; f"
ch = "!f() { \
if [[ $# -eq 0 || \"$1\" == \".\" ]]; then \
git checkout .; \
else \
files_to_add=(); \
for arg in $(seq $(git status --porcelain | wc -l)); do \
files_to_add+=($(git status --porcelain | sed -n ${arg}p | awk '{print $2}')); \
done; \
if [[ $1 == *'-'* ]]; then \
IFS='-' read -ra RANGE <<< \"$1\"; \
for i in $(seq ${RANGE[0]} ${RANGE[1]}); do \
git checkout \"${files_to_add[$i-1]}\"; \
done; \
elif [[ $1 == *','* ]]; then \
IFS=',' read -ra NUMS <<< \"$1\"; \
for i in \"${NUMS[@]}\"; do \
git checkout \"${files_to_add[$i-1]}\"; \
done; \
else \
git checkout \"${files_to_add[$1-1]}\"; \
fi; \
fi; \
}; f"
d = "!f() { \
if [[ $# -eq 0 || \"$1\" == \".\" ]]; then \
git diff .; \
else \
files_to_add=(); \
for arg in $(seq $(git status --porcelain | wc -l)); do \
files_to_add+=($(git status --porcelain | sed -n ${arg}p | awk '{print $2}')); \
done; \
if [[ $1 == *'-'* ]]; then \
IFS='-' read -ra RANGE <<< \"$1\"; \
for i in $(seq ${RANGE[0]} ${RANGE[1]}); do \
git diff \"${files_to_add[$i-1]}\"; \
done; \
elif [[ $1 == *','* ]]; then \
IFS=',' read -ra NUMS <<< \"$1\"; \
for i in \"${NUMS[@]}\"; do \
git diff \"${files_to_add[$i-1]}\"; \
done; \
else \
git diff \"${files_to_add[$1-1]}\"; \
fi; \
fi; \
}; f"
dc = "!f() { \
if [[ $# -eq 0 || \"$1\" == \".\" ]]; then \
git diff --cached .; \
else \
files_to_add=(); \
for arg in $(seq $(git status --porcelain | wc -l)); do \
files_to_add+=($(git status --porcelain | sed -n ${arg}p | awk '{print $2}')); \
done; \
if [[ $1 == *'-'* ]]; then \
IFS='-' read -ra RANGE <<< \"$1\"; \
for i in $(seq ${RANGE[0]} ${RANGE[1]}); do \
git diff --cached \"${files_to_add[$i-1]}\"; \
done; \
elif [[ $1 == *','* ]]; then \
IFS=',' read -ra NUMS <<< \"$1\"; \
for i in \"${NUMS[@]}\"; do \
git diff --cached \"${files_to_add[$i-1]}\"; \
done; \
else \
git diff --cached \"${files_to_add[$1-1]}\"; \
fi; \
fi; \
}; f"
ds = "!f() { \
if [[ $# -eq 0 || \"$1\" == \".\" ]]; then \
git diff --staged .; \
else \
files_to_add=(); \
for arg in $(seq $(git status --porcelain | wc -l)); do \
files_to_add+=($(git status --porcelain | sed -n ${arg}p | awk '{print $2}')); \
done; \
if [[ $1 == *'-'* ]]; then \
IFS='-' read -ra RANGE <<< \"$1\"; \
for i in $(seq ${RANGE[0]} ${RANGE[1]}); do \
git diff --staged \"${files_to_add[$i-1]}\"; \
done; \
elif [[ $1 == *','* ]]; then \
IFS=',' read -ra NUMS <<< \"$1\"; \
for i in \"${NUMS[@]}\"; do \
git diff --staged \"${files_to_add[$i-1]}\"; \
done; \
else \
git diff --staged \"${files_to_add[$1-1]}\"; \
fi; \
fi; \
}; f"
[core]
editor = vim
#editor = idea -e --wait
excludesfile = ~/.gitignore_global
attributesfile = ~/.gitattributes
whitespace = trailing-space,space-before-tab
pager = "delta"
[credential]
helper = osxkeychain
[feature]
manyFiles = 1
[includeIf "gitdir:~/src/off/"]
path = ~/.gitconfig-off
[includeIf "gitdir:~/caper-configs-mirror/"]
path = ~/.gitconfig-off
[includeIf "gitdir:~/src/oss/"]
path = ~/.gitconfig-oss
[includeIf "gitdir:~/src/per/"]
path = ~/.gitconfig-per
[color]
ui = always # Use colors in Git commands that are capable of colored output when outputting to the terminal
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
# meta = magenta bold
# frag = cyan bold
# old = red reverse
# new = green reverse
# whitespace = red reverse
[color "status"]
header = white normal dim
added = red
changed = green
untracked = blue
branch = yellow
[diff]
colorMoved = default
mnemonicprefix = true
compactionHeuristic = true
show = delta
[delta]
file-decoration-style = black ul
file-style = box gray
hunk-header-decoration-style = black ul
hunk-header-style = omit
line-numbers = true
line-numbers-left-format = {nm:>3}│
line-numbers-left-style = black
line-numbers-minus-style = black
line-numbers-plus-style = black
line-numbers-right-format = {np:>3}│
line-numbers-right-style = black
line-numbers-zero-style = black
minus-emph-style = red bold
minus-empty-line-marker-style = omit
minus-style = red
navigate = false
plus-emph-style = green bold
plus-empty-line-marker-style = omit
plus-style = green
side-by-side = false
syntax-theme = base16
true-color = auto
whitespace-error-style = red reverse
zero-style = black
[pager]
show = delta
[merge]
tool = idea
; log = true
; stat = true
; conflictStyle = diff3
[mergetool]
keepBackup = false
[mergetool "idea"]
cmd = idea merge $LOCAL $REMOTE $BASE $MERGED
trustExitCode = true
[mergetool "meld"]
cmd = meld "$LOCAL" "$MERGED" "$REMOTE" --output "$MERGED"
; cmd = meld "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED"
[mergetool "vscode"]
cmd = code --wait $MERGED
[interactive]
diffFilter = delta
[pull]
rebase = false
[push]
default = tracking
autoSetupRemote = true
[status]
submoduleSummary = true
[url "[email protected]:"] # URL shorthands
insteadOf = "gh:"
pushInsteadOf = "github:"
pushInsteadOf = "git://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:"
[index]
skipHash = false
[log]
follow = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[branch]
sort = -committerdate
[fetch]
prune = true