-
Notifications
You must be signed in to change notification settings - Fork 26
/
.gitconfig
270 lines (217 loc) · 10.4 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
[user]
# name = user
# email = user@server
[core]
pager = less -S
excludesfile = ~/bin/rc/gitignore_global
[include]
path = .gitconfig_work
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[alias]
#short status
s = status -s -b
#create new branch and check it out
cb = checkout -b
bc = checkout -b
b = branch
c = checkout
p = push
pu = pull --ff-only
f = fetch
fa = fetch --all
cm = commit -am
co = commit
ca = commit --amend
#safe merging
m = merge --ff-only
mff = merge --ff-only
mnff = merge --no-ff
rb = rebase
rba = rebase --autosquash -i
rbi = rebase -i
rbcont = rebase --continue
rbas = rebase --autostash
u = add --update :/
#diffs
d = diff --stat
#diff with no whitespace
db = diff -b
#diff with words only and no whitespace
dw = diff --color-words -b
dd = diff --color-words -b
dh = diff --color-words -b HEAD
diff=diff --ws-error-highlight=all
# support easy change of identity
identity = "! git config user.name \"$(git config user.$1.name)\"; git config user.email \"$(git config user.$1.email)\"; git config user.signingkey \"$(git config user.$1.signingkey)\"; :"
#graphs
g = log --oneline --decorate --graph --all
gg = log --oneline --decorate --graph
go = log --graph --all --pretty=format:'%C(yellow)%h%Creset%C(red bold)%d%Creset %s %Cgreen(%cr) %C(blue)<%an>%Creset' --decorate --abbrev-commit
god = log --graph --all --pretty=format:'%C(yellow)%h%Creset%C(red bold)%d%Creset %s %Cgreen(%ci) %C(blue)<%an>%Creset' --decorate --abbrev-commit
go2 = log --graph --pretty=format:'%C(yellow)%h%Creset%C(red bold)%d%Creset %s %Cgreen(%cr) %C(blue)<%an>%Creset' --decorate --abbrev-commit
god2 = log --graph --pretty=format:'%C(yellow)%h%Creset%C(red bold)%d%Creset %s %Cgreen(%ci) %C(blue)<%an>%Creset' --decorate --abbrev-commit
glo2 = log --pretty=format:'%C(yellow)%h%Creset%C(red bold)%d%Creset %s %Cgreen(%cr) %C(blue)<%an>%Creset' --decorate --abbrev-commit
glod2 = log --pretty=format:'%C(yellow)%h%Creset%C(red bold)%d%Creset %s %Cgreen(%ci) %C(blue)<%an>%Creset' --decorate --abbrev-commit
# date ordered
gdd = log --graph --pretty=format:'%C(yellow)%h%Creset%C(red bold)%d%Creset %s %Cgreen(%cr) %C(blue)<%an>%Creset' --decorate --abbrev-commit --all --author-date-order
gd = log --oneline --decorate --graph --all --author-date-order
gb = log --graph --simplify-by-decoration --pretty=format:'%C(yellow)%h%C(yellow bold)%d %C(white)%s %C(bold black)%ar %C(reset)%n' --all
gbd = log --graph --simplify-by-decoration --pretty=format:'%C(yellow)%h%C(yellow bold)%d %C(white)%s %C(bold black)%ai %C(reset)%n' --all
g2 = log --graph --pretty=format':%s %C(bold blue)%an, %ar %Cgreen(%h)%Creset'
g3 = log --pretty=format:"%Cgreen%h%Creset %ad %C(cyan)%an%Creset %s%C(red)%d%Creset" --graph --date=short
g4 = log --graph --abbrev-commit --decorate --all --format=format:\"%C(bold blue)%h%C(dim black) %C(reset)%C(dim white)%aD%C(dim black) %C(bold blue)%an%C(reset) %C(green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)\"
g5 = log --graph --abbrev-commit --decorate --all --format=format:\"%C(bold blue)%h%C(reset) %C(bold cyan)%aD%C(dim white) %an%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)\"
logMerges = log --first-parent --graph
glong = log --stat --decorate --graph --all
ll = log --pretty=format:\"%C(yellow)%h %C(red bold)%d %C(white bold)%s %Creset%Cgreen(%cr) %C(blue)<%an>%Creset %n\" --decorate --stat --graph --all
#graph with diffs, useful for tracking one file history
gdiff = log --oneline --decorate --graph --full-history -p -c --color-words -b
gdifff = log --oneline --decorate --graph --follow --full-history -p -c --color-words -b
gldiff = log --format=medium --decorate --graph -p -c
gldifff = log --format=medium --decorate --graph --follow -p -c
gldd = log --decorate --graph --stat --pretty=format:'%C(yellow)%h%Creset%C(red bold)%d%Creset %s %Cgreen(%ci) %C(blue)<%an>%Creset%n'
glddf = log --decorate --graph --all --full-history --stat --pretty=format:'%C(yellow)%h%Creset%C(red bold)%d%Creset %s %Cgreen(%ci) %C(blue)<%an>%Creset%n'
# https://salferrarello.com/using-vim-view-git-commits/
# View commit with K (upper case k)
vim = "!git log --graph --oneline --decorate --all --pretty=format:'%h %d %s (%ci) <%an>' | vim -R -c \"set filetype=git nowrap\" -"
nvim = "!git log --graph --oneline --decorate --all --pretty=format:'%h %d %s (%ci) <%an>' | nvim -R -c \"set filetype=git nowrap\" -"
mt = mergetool
mtv = mergetool --tool=vimdiff
mtk = mergetool --tool=kdiff3
dt = difftool
dtv = difftool --tool=vimdiff
dtk = difftool --tool=kdiff3
listExcluded = ls-files --other --ignored --exclude-standard
ls-excluded = ls-files --other --ignored --exclude-standard
ls = ls-files -c --exclude-standard
ls-all = ls-files -co --exclude-standard
logBranch = log --no-merges
sh = show
sss = show
ss = show --stat
home = rev-parse --show-toplevel
movebranchto = branch -f
moveto = reset --hard
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -"
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
#Human aliases :)
bb = for-each-ref --sort=-committerdate --format=\"%(color:bold black)%(authordate:relative)\t%(color:white)%(authorname)\t%(color:cyan bold)%(HEAD) %(color:green nobold)%(refname:short) %(color:white)-> %(upstream:short)\" refs/heads refs/remotes
branches = for-each-ref --sort=-committerdate --format=\"%(color:bold black)%(authordate:relative)\t%(color:white)%(authorname)\t%(color:cyan bold)%(HEAD) %(color:green nobold)%(refname:short) %(color:white)-> %(upstream:short)\" refs/heads refs/remotes
tags = tag
stashes = stash list
remotes = remote -v
upstream = branch --set-upstream-to
stash-all = stash save --include-untracked
unstage = reset -q HEAD --
discard = checkout --
uncommit = reset --mixed HEAD~
amend = commit --amend
qamend = "!git dd && git add --update :/ && git commit --amend --no-edit"
detach = checkout --detach HEAD
# Add a file/directory to your .gitignore
ignore = "!f() { echo \"$1\" >> .gitignore; }; f"
# Show which commits are safe to amend/rebase
unpushed = log @{u}..
# Show what you've done since yesterday to prepare your standup
daily = "!git log --since yesterday --author $(git config user.email) --pretty=short --stat"
daily1w = "!git log --since '1 weeks ago' --author $(git config user.email) --pretty=short --stat"
daily2w = "!git log --since '2 weeks ago' --author $(git config user.email) --pretty=short --stat"
daily3w = "!git log --since '3 weeks ago' --author $(git config user.email) --pretty=short --stat"
daily4w = "!git log --since '4 weeks ago' --author $(git config user.email) --pretty=short --stat"
# Show the history difference between a local branche and its remote
divergence = "!git log --left-right --graph --cherry-pick --oneline $1~...$2~"
divergence2 = "!git log --left-right --graph --cherry-pick --oneline $1...origin/$1"
# divergence = log --left-right --graph --cherry-pick --oneline $1...origin/$1
# Which branch and tags contain a commit
contains= "!f() { git tag --contains $1; git branch -a --contains $1; }; f"
# Find tags containing commit
containstag = "!f() { git tag --contains $1; }; f"
# Find branches containing commit
containsbranch = "!f() { git branch -a --contains $1; }; f"
# Find commits by source code
fc = "!f() { git l --date=short -S$1; }; f"
# find file in repo
find = "!git ls-files | grep -i"
grep = grep -Ii
aliases = "!git config -l | grep alias | cut -c 7-"
lasttag = describe --tags --abbrev=0
# prevent checking of changes on some files
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
assumeall = "!git st -s | awk {'print $2'} | xargs git assume"
# unstages changes in the index, discards changes in the working directory, and removes any new files.
nevermindall = !git reset --hard HEAD && git clean -d -f
# as above, but keeps untraced
nevermind = reset --hard HEAD
nevermindunstaged = checkout -- .
diffstaged = diff --cached --diff-algorithm=minimal -w
wip = commit --fixup HEAD
wipm = commit --squash HEAD -m
# use git fixup COMMIT to change a specific "COMMIT", exactly like you would use git commit --amend to change the latest one.
# You can use all git commit arguments, like -a, -p and filenames. It will respect your index, so you can use git add. It won't touch the changes you are not committing.
fixuprb = "!f() { TARGET=$(git rev-parse "$1"); git commit --fixup=$TARGET ${@:2} && EDITOR=true git rebase -i --autostash --autosquash $TARGET^; }; f"
fixup = commit --fixup
squash = commit --squash
[rebase]
autostash = true
[fetch]
prune = true
[push]
default = current
followTags = true
[merge]
defaultToUpstream = true
tool = vimdiff
conflictstyle = diff3
[diff]
# indentHeuristic = true
# 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
[credential]
helper = store
[remote-hg]
track-branches = false
[help]
autocorrect = 30
[commit]
verbose = 1
[cola]
spellcheck = false
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
[init]
defaultBranch = master
[gpg]
program = /usr/bin/gpg2
[safe]
directory = *