-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitconfig
More file actions
310 lines (280 loc) · 9.36 KB
/
.gitconfig
File metadata and controls
310 lines (280 loc) · 9.36 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
[include]
# For username / creds / etc
path = ~/.gitconfig.local
[status]
submodulesummary = true # meh, why not. don't use submodules unless you have to
[push]
# 'current' should be the safe default. Without this, by default, 'git push'
# will push all branches, possibly pushing unintended changes
default = current
[diff]
renames = true
renameLimit = 2000
noprefix = true # drops the annoying a/filename.foo b/filename.foo prefixes
[merge]
# This is REALLY useful. Adds 'original_version' to diffs like so:
# <<<<<<<
# OUR_VERSION
# |||||||
# ORIGNINAL_VERSION
# =======
# THEIR_VERSION
# >>>>>>>
conflictstyle = diff3
defaultToUpstream = true
[core]
excludesfile = .gitignore.local
editor = vim
[format]
pretty = fuller # more detail for "git show"
[color]
ui = true # everybody loves color (except for Linus :( )
[column]
# This lets "git stat" stack multiple filenames per row (like vanilla 'ls')
ui = always
[pretty]
# Key:
# %h: abbreviated commit hash (bright yellow)
# %ar: author date, relative (bright green)
# %an: author name (red)
# %s: subject (plain)
# %d: ref names, like --decorate (pink)
hist = "\
%C(bold yellow)%h\
%C(reset)%C(yellow) %t\
%C(bold green) (%ar)\
%C(reset)%C(red) [%an]\
%C(reset) %s\
%C(bold red) %d\
%C(reset)"
histp = "\
%C(reset)%C(yellow)%p\
%C(reset) ->\
%C(bold yellow)%h\
%C(bold green) (%ad)\
%C(reset)%C(red) [%an]\
%C(reset) %s\
%C(bold red) %d\
%C(reset)"
# Key:
# %gD: reflog selector, e.g., refs/stash@{1}
# %gs: reflog subject
# (remainder same as pretty=hist)
ghist = "\
%C(bold blue)%gD\
%C(reset)%C(blue) %gs\n\
\
%C(bold yellow)%h\
%C(bold green) (%ar)\
%C(reset)%C(red) [%an]\
%C(reset) %s\
%C(bold red) %d\
%C(reset)"
# DAILY: aliases core to my workflow.
[alias]
# Short Forms
co = checkout
st = status --short --branch --untracked-files=no
sta = status --short --branch --untracked-files=no
stat = status --short --branch --untracked-files=normal
statall = status --short --branch --untracked-files=normal --ignored=traditional
which = help
ss = show --stat
dc = diff --cached
fixup = commit --fixup
amend = commit --amend --no-edit
export = "!git commit --amend --no-edit; git5 export"
u = "!git add -u; git st"
rebi = rebase -i
pick = cherry-pick
ff = merge --ff-only
b = !git branch -vv
ba = !git branch -avv
vs = !git --paginate versus # Defined below.
vb = !git vs blank
# Rebasing
abort = rebase --abort
continue = rebase --continue
skip = rebase --skip
# Meh. ...
autosquash = rebase -i HEAD~20 --autosquash --preserve-merges
# Log w/o merges.
hlog = !git log --graph --max-parents=1 --date-order --color=always --pretty=hist
h = !git --no-pager hlog -10
hh = !git --no-pager hlog -20
hhh = !git --no-pager hlog -40
hhhh = !git --no-pager hlog
# Log w/ merges.
mlog = !git log --graph --date-order --color=always --pretty=hist
m = !git --no-pager mlog -10
mm = !git --no-pager mlog -20
mmm = !git --no-pager mlog -40
mmmm = !git --no-pager mlog
# Reflog history
glog = !"\
git log \
--color=always \
--date=relative \
--walk-reflogs \
--invert-grep \
--grep-reflog=ceheckout: \
--pretty=ghist \
"$@" \
| perl -ne '\
if (m/HEAD/ && !m/HEAD.*checkout/) { \
$print = 2; \
$primed = 1; \
} \
if ($primed and m/HEAD.*checkout/) { \
$print = 1; \
$primed = 0; \
} \
if ($print) { \
print; \
$print -= 1; \
};'"
g = !git --no-pager glog
gg = !git --no-pager glog -20
ggg = !git --no-pager glog -40
gggg = !git --no-pager glog
histstat= "!\
git h --stat=160,160 \"$@\" \
| perl -ne ' \
/([|*])/; \
if($1 eq \"*\") { \
print \
} else { \
m/[|] *[0-9]/ and print \
}'; \
true"
hstat = !git --no-pager histstat -10
hhstat = !git --no-pager histstat -20
hhhstat = !git --no-pager histstat
hstats = !git h --shortstat --dirstat=changes,10
hhstats = !git hh --shortstat --dirstat=changes,10
hhhstats= !git hhh--shortstat --dirstat=changes,10
################################################################################
# USEFUL ALIASES (ala git's "porcelain")
[alias]
# git-versus compares the current branch to origin/master or a branch of your
# choosing, displaying commits to/from the other branch
# Try "git vs --stat" as well
# TODO: clean this up to use only plumbing commands:
# http://schacon.github.com/git/git.html#_low_level_commands_plumbing
versus = "! \
O=(); \
SEEN_DD=false; \
unset A; \
while [ ! -z \"$1\" ]; do \
if [[ \"$1\" =~ ^- ]] || $SEEN_DD; then \
O=(\"${O[@]}\" $1); \
if [ \"$1\" == \"--\" ]; then SEEN_DD=true; fi; \
elif [ -z \"$A\" ]; then \
A=\"$1\"; \
else \
O=(\"${O[@]}\" \"$1\"); \
fi; \
shift; \
done; \
if ! $SEEN_DD; then O=(\"${O[@]}\" \"--\"); fi; \
if [ -z \"$A\" ]; then \
A=$(git first-valid-rev origin/master blank); \
fi; \
A=\"${A-origin/master}\"; \
B=\"$(git symbolic-ref HEAD --short || git rev-parse HEAD)\"; \
echo From \"$A..$B:\"; \
git --no-pager mlog $A..$B \"${O[@]}\"; \
echo; \
echo From \"$B..$A:\"; \
git --no-pager mlog $B..$A \"${O[@]}\"; \
"
# For repos with multiple working trees [git-worktree]. Parking a secondary
# working-dir on a 'detached' head (ie, not a named branch) prevents the
# situation where changes to the named branch, made on he primary working-dir,
# manifest as an inverse diff on the secondary working-dir (shows up 'green',
# ie, staged but uncommitted).
detach = !"\
if ! git symbolic-ref --quiet HEAD >/dev/null; then \
echo \"Already detached\" && exit; \
fi; \
echo \"Detaching HEAD from $(git current-branch) to $(git rev-parse HEAD)\"; \
git-checkout --quiet $(git rev-parse HEAD)"
retach = !git-checkout $(git name-rev --name-only HEAD)
drop = !git5 drop "$@" && git b -D "$@"
# Fetch-Rebase: pure AWESOMEness.
# Fetches 'origin' and rebases the current branch on top of origin/master.
# Uses 'stash' intelligently to avoid blocking on trivial working-dir changes
frb = "! \
git fetch; \
if git diff-index --quiet --ignore-submodules HEAD --; then \
git rebase origin/master \"$@\"; \
else \
git stash save -q 'Fetch-Rebase Stashed Changes'; \
git rebase origin/master \"$@\"; \
git stash pop -q; \
fi; true"
# Rebase-interactive: allows editing the specified commit
rbi = "! git rebase -i $1^"
rbh1 = rebase -i HEAD^
rbh2 = rebase -i HEAD^^
rbh3 = rebase -i HEAD^^^
rbh4 = rebase -i HEAD^^^^
rbh5 = rebase -i HEAD^^^^^
rbh6 = rebase -i HEAD^^^^^^
rbh7 = rebase -i HEAD^^^^^^^
rbh8 = rebase -i HEAD^^^^^^^^
rbh9 = rebase -i HEAD^^^^^^^^^
# List files ignored by .gitignore and friends
show-ignored = "! \
git clean -ndX | \
perl -pe 's/Would remove/ignored:/'"
find-children = "! \
REVSPEC="$(git rev-parse "$1")" || exit; \
git rev-list $REVSPEC^.. --parents | \
grep $REVSPEC | \
cut -d' ' -f1 | \
xargs git show -s --format=histp --graph --color=always | \
grep .; \
true"
#############################################################################
# PLUMBING: not intended for direct use.
# Plunbing: Print the current branch name.
current-branch = symbolic-ref --quiet --short HEAD
# Plumbing: echo back the first rev name that exists.
first-valid-rev = "! \
while [ ! -z \"$1\" ]; do \
git rev-parse -q --verify --symbolic \"$1\" && exit; \
shift; \
done; \
# None found \
exit 1 \
"
###############################################################################
# DEMO: demonstrate git's behavior and effed-up flags architecture.
[alias]
# Document symbolic name patterns (this is way more messy than it seems).
# {input} = {symbolic0} | {symbolic1} | {symbolic2}
# --------------------------------|-----------------|-------------
# HEAD(=branch) = HEAD | branch | branch
# HEAD(=88916d7) = HEAD | branch_2 | ''
# branch = branch | branch | ''
# invalid = '' | {error!} | ''
symbolic0 = rev-parse --verify --quiet --symbolic # Literal.
symbolic1 = name-rev --always --name-only # Branch name.
symbolic2 = symbolic-ref --quiet --short # HEAD-to-branch-name (one-trick-pony)
symbolic-demo = !"\
HASH=$(git rev-parse HEAD); \
BNAME=$(git current-branch); \
echo HASH=\"$HASH\"; \
echo BNAME=\"$BNAME\"; \
for method in symbolic0 symbolic1 symbolic2; do \
git checkout --quiet \"$HASH\" || exit; \
echo \"$method: deHEAD => $(git $method HEAD)\"; \
git checkout --quiet \"$BNAME\" || exit; \
for name in HEAD \"$BNAME\" \"$HASH\" inval1d; do \
echo \"$method: $name => $(git $method $name)\"; \
done; \
echo; \
done; \
git checkout --quiet \"$BNAME\"; \
"