forked from hkdobrev/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
382 lines (282 loc) · 11 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
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
####################################
# Global configuration file for Git.
####################################
# A lot of aliases to speed up full-time usage of Git from command line.
# Long flag names are used for readability wherever possible.
# Short flags are meant for writing on the command line.
[alias]
# Shorthand for add
a = add
# Add all unstaged (including untracked) files.
# See`git help add`
aa = add --all
# Interactive add. Used for patching.
# See`git help add`
ai = add --interactive
# List Git aliases with definitions
aliases = ! git config --get-regexp ^alias\\. | grep -v "^alias\\.aliases" | sed -e 's/^alias\\.//' -e 's/\\ /\\ =\\ /'
# Amend the currently staged files to the last commit
# See`git help commit`
amend = commit --amend --reuse-message=HEAD
# Shorthand for branch
b = branch
# Delete a branch only if it is merged in the current branch.
# See`git help branch`
bd = branch --delete
# Shorthand for branch --merged
bm = branch --merged
# Shorthand for browse
# See`hub help browse`
br = browse
# Shorthand for commit
c = commit
# Shorthand for checkout
ch = checkout
# Checkout a branch. Create it if it doesn't exist
# See`git help checkout`
chb = checkout -B
# Shorthand for clone
cl = clone
# Delete all untracked files and directories.
# See`git help clean`
cleanit = clean -fd
# Shorthand for config
# See`git help config` for config options
cn = config
# Shorthand for global config
cng = config --global
# List contributors with number of commits
# See`git help shortlog`
contributors = shortlog --summary --numbered
# Credit an author on the latest commit
credit = "!f() { git commit --amend --author \"$1 <$2>\" --reuse-message=HEAD; }; f"
# Show the diff between the latest commit and the current state
d = diff
# Diff staging area (a.k.a index) to HEAD (a.k.a last commit)
dc = diff --cached
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
# Diff working tree to HEAD (a.k.a last commit).
# Using difftool.tool for visualising diffs.
# Do not prompt for each file. Use --prompt to override.
dt = difftool --no-prompt
# Diff staging area (a.k.a index) to HEAD (a.k.a last commit).
# Using difftool.tool for visualising diffs.
# Do not prompt for each file. Use --prompt to override.
dtc = difftool --cached --no-prompt
# Remove branches that have already been merged with master
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
# Shorthand for fetch
f = fetch
# Find branches containing commit
fb = "!f() { git branch -a --contains $1; }; f"
# Find commits by source code
fc = "!f() { git l --date=short -S$1; }; f"
# In case of fire
# https://twitter.com/bozhobg/status/650265599671693312
fire = "!git commit --all && git push --set-upstream origin HEAD && echo 'LEAVE BUILDING!!!'"
# Find commits by commit message
fm = "!f() { git l --date=short --grep=$1; }; f"
# Find tags containing commit
ft = "!f() { git describe --always --contains $1; }; f"
# Shorthand for help
h = help
# Pretty log of commits. Supports options of git log
# The 8-char abbreviation works well with the default pretty format below
l = log --abbrev-commit --abbrev=8
# Same as l, but with graph.
# Recursive resolving of aliases break tab-completion for options,
# so the command is listed again.
lg = log --abbrev-commit --abbrev=8 --graph
# Same as above, but list local commits not on upstream
local = log --abbrev-commit --abbrev=8 @{u}..
# Shorthand for merge
m = merge
# Shorthand for mergetool
mt = mergetool
# Log commits authored by me
mylog = !git log --author=\"$(git config user.name)\"
# Show the not merged branches compared to the current branch
nm = branch --no-merged
# Show the not merged branches compared to the master branch
nmm = branch --no-merged master
# Shorthand for push
p = push
# Shorthand for pull
pl = pull --ff-only
# Create a new remote branch with the same name and track it.
# First argument is remote name. Defaults to "origin".
# Second, third and fourth argument are passed to `git push`.
publish = "!p() { [ -z \"$1\" ] && remote=\"origin\" || remote=$1; git push --set-upstream $2 $3 $4 $remote HEAD; }; p"
# Push force with a check if all the commits you are overriding on the remote
# were previously present in the remote reference in your repository.
# This way force push is safer as it wouldn't overwrite commits by other team members
# pushed to the remote branch after you've last pulled and rewritten some history.
pushf = push --force-with-lease
# Shorthand for remote
r = remote
report = log --abbrev-commit --abbrev=8 --since=1.week.ago --first-parent --reverse
# Interactive rebase with the given number of latest commits
ri = "!r() { git rebase --interactive HEAD~$1; }; r"
# Update all remotes
ru = remote update
# Shorthand for rebase
rb = rebase
# Shorthand for reset
rs = reset
# View the current working tree status using the short format
# Show the current branch as well
# See`git help status`
s = status --short --branch
# Shorthand for show
sh = show
# Shorthand for shortlog
shl = shortlog
# Shorthand for stash
st = stash
standup = log --all --no-merges --graph --date=relative --committer=$(git config --get user.email) --pretty=format:'%C(cyan) %ad %C(yellow)%h %Creset %s %Cgreen%d' --since="$(if [[ "Mon" == "$(date +%a)" ]]; then echo "last friday"; else echo "yesterday"; fi)"
# Pull with rebase and push with configured upstream branch
sync = git show --stat pull --rebase && git push
# Shorthand for tag
t = tag
[apply]
# Detect whitespace errors when applying a patch
whitespace = warn
[color]
# Use colors in Git commands that are capable of colored output when
# outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.)
ui = auto
[color "branch"]
# Highlight current. Yellow local branches; Green remotes.
current = yellow reverse
local = yellow
remote = green
[color "diff"]
# Yellow meta; Magenta line info; Red for deleltions; Green for additions.
meta = yellow
frag = magenta
old = red
new = green
whitespace = red reverse
[color "status"]
# Changed files are yellow.
# Staged files are green.
# New (untracked) files are cyan.
# Headers are gray (white dimmed)
# Branch is always green even in headers
added = green
branch = green
changed = yellow
header = white dim
untracked = cyan
[core]
# Global `.gitattributes`
attributesfile = ~/.gitattributes
# Default editor for commit messages and other inputs
# Even when EDITOR is set to something else
editor=vim
# Global `.gitignore`
excludesfile = ~/.gitignore_global
# Make `git rebase` safer on OS X
# More info: http://www.git-tower.com/blog/make-git-rebase-safe-on-osx
trustctime = false
# Treat
# - spaces before tabs,
# - lines that are indented with tabs,
# - all kinds of trailing whitespace
# as an error.
whitespace = space-before-tab,trailing-space,tab-in-indent
[diff]
# Use more time to create better diffs.
# E.g. matching opening/closing braces from neighbour functions.
# See "`git help diff` --patience" and "`git help merge` recursive".
algorithm = patience
# Use blank lines as a strong hint to identify the changes
compactionHeuristic = true
# Diff will detect both renames and copies.
renames = copies
# Default to vimdiff for visualising diffs.
# Override with --tool=<tool> in difftool
# See`git help difftool`
# See`git help config` and search for "diff.tool"
tool=opendiff
[diff "asciidiff"]
textconv = ~/bin/img-ascii-diff
[diff "javascript"]
xfuncname = "^\\s*(.*?\\bfunction\\b.*?\\(.*?\\))"
[diff-so-fancy]
# Configure diff-so-fancy with ASCII separators
useUnicodeRuler = false
[difftool]
# Difftool will not prompt for every file.
# Use --prompt to override.
prompt = false
[format]
pretty = colourful
[help]
# Automatically correct and execute mistyped commands
autocorrect = 1
[interactive]
diffFilter = diff-so-fancy | less --tabs=4 --RAW-CONTROL-CHARS --quit-if-one-screen --no-init --tilde --status-column --HILITE-UNREAD
[log]
# Always use .mailmap resolution of author names and emails in git-log
mailmap = 1
[mailmap]
file = ~/.mailmap
[merge]
# Include summaries of merged commits in newly created merge commit messages
log = true
# opendiff opens FileMerge
tool = opendiff
[mergetool]
# No *.orig files left when using mergetool.
keepBackup = false
# Mergetool will not prompt for every file.
# Use --prompt to override.
prompt = false
[pager]
# Use colors when paging regardless of default color setting.
color = true
diff = diff-so-fancy | less --tabs=4 --RAW-CONTROL-CHARS --quit-if-one-screen --no-init --tilde --status-column --HILITE-UNREAD
show = diff-so-fancy | less --tabs=4 --RAW-CONTROL-CHARS --quit-if-one-screen --no-init --tilde --status-column --HILITE-UNREAD
[pretty]
colourful = "format:%Cred%<(8)%h%Creset %<(75,trunc)%s %Cgreen%<(11)%cr%Creset%Cblue%<(17)% aN%Creset%C(yellow)% D%Creset %gN"
live = "format:%Cred%<(6)%h%Creset %<(50,trunc)%s%C(yellow)% D%Creset %gN"
[push]
# See `git help config` and search for "push.default"
# for more information on different options of the below setting.
# Setting to Git 2.0 default to surpress warning message
# If you use branches with different remote name, use "upstream"
default = simple
[rebase]
# Use --autosquash by default. It's not like one would write !fixup message by accident.
autoSquash = true
# Use --autostash when running git pull --rebase and when rebasing interactively
autoStash = true
# Warn about removed commits in interactive mode
missingCommitsCheck = warn
[rerere]
# Reuse recorded resolutions
enabled = true
# URL shorthands
#
# See `git help config` and search for "url.<base>"
#
# gh: is a shorthand for [email protected]
[url "[email protected]:"]
insteadOf = "gh:"
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
# github: is a shorthand for git://github.com/
[url "git://github.com/"]
insteadOf = "github:"
# gst: is a shorthand for git://gist.github.com/
[url "[email protected]:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
# gist: is a shofthand for git://gist.github.com/
[url "git://gist.github.com/"]
insteadOf = "gist:"
[include]
path = .gitconfig.extra