-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
218 lines (171 loc) · 4.94 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
[apply]
whitespace = fix
[branch]
autosetupmerge = true
[core]
editor = gedit -w -s
pager = less -x1,5
whitespace = trailing-space,space-before-tab,tabwidth=4
[color]
ui = auto
branch = auto
[color "diff"]
whitespace = green reverse
[color "grep"]
filename = normal dim
linenumber = normal dim
separator = normal dim
[color "status"]
untracked = yellow
[commit]
template = ~/.git/templates/commit-msg
[diff]
renames = copies
mnemonicprefix = true
[filter "trimWhitespace"]
clean = git-stripspace
[grep]
lineNumber = true
extendedRegexp = true
[init]
templatedir = ~/.git/templates
[log]
decorate = short
date = iso
abbrevCommit = true
[merge]
conflictstyle = diff3
stat = true
[pull]
rebase = true
[push]
default = simple
[rebase]
autosquash = true
[rerere]
enabled = true
[status]
short = true
branch = true
[tag]
sort = version:refname
[alias]
# Short aliases
aa = add -A
am = !git amend
ama = !git amend-all
ama-no-edit = !git amend-all-no-edit
amn = !git amend-no-edit
aman = !git amend-all-no-edit
bl = blame
br = branch
c = commit
ca = commit -a
cam = commit -a -m
ci = commit
cm = commit -m
co = checkout
cob = checkout -b
cp = cherry-pick
cs = commit --squash=@
cf = commit --fixup=@
di = diff
diw = diff --color-words
fu = !git fubar
fuc = !git fubar-clean
ir = rebase -i
mg = merge
mr = merge
ol = !git oneline
pl = pull
prc = !git pr-check
ps = push
re = reflog
r = rebase
rb = rebase
ri = rebase -i
sa = stash apply
sc = !git cs
sf = !git cf
sl = stash list
sq = !git cs
ss = stash save
st = !"git -c color.status=always status --long | sed -r 's/Changes to be committed.*/Staged:/' | sed -r 's/Changes not staged.*/Unstaged:/' | sed -r 's/Untracked.*/Untracked:/' | egrep -v '^\\s+\\(use.*$' | egrep '^\\s+.*$|Staged:|Unstaged:|Untracked:|nothing to commit.*'"
# Basics
discard = checkout --
delete = !git rm $(git ls-files -d)
undelete = checkout --
unstage = reset HEAD
untrack = reset HEAD
undo = reset --soft
fubar = reset --hard
fubar-clean = !git reset --hard && git clean -fd
force-pull = !git fetch ${1:-origin} $(git rev-parse --abbrev-ref HEAD) && git fu $(git rev-parse --abbrev-ref --symbolic-full-name @{u})
amend = commit --amend
amend-all = commit -a --amend
amend-all-no-edit = commit -a --amend --no-edit
amend-no-edit = commit --amend --no-edit
blame-precise = blame -w -M -CC
save = stash save
load = stash apply
pop = stash pop
stashes = stash list
branches = branch --list --all -vv
remotes = remote -vv
pickaxe-string = log -p --all -S
pickaxe-s = !git pickaxe-string
pickaxe-regex = log -p --all -G
pickaxe-r = !git pickaxe-regex
pickaxe-g = !git pickaxe-regex
# Diff
diff-word = diff --color-words
# Log
oneline = log --abbrev-commit --date=short --format=format:'%C(yellow)%h%C(reset) %C(cyan)%ad %C(reset)%s %C(magenta)[%an]%C(reset)'
current = log -1
last = !git oneline -8
latest = !git last
log-diff = log -u
log-graph = log --graph --oneline
# Ignore
assume = update-index --assume-unchanged
ignore = !git skip
skip = update-index --skip-worktree
unassume = update-index --no-assume-unchanged
unignore = !git unskip
unskip = update-index --no-skip-worktree
assume-all = "!git st -s | awk {'print $2'} | xargs git assume"
ignore-all = !git skip-all
skip-all = !git st -s | awk {'print $2'} | xargs git skip
unassume-all = "!git list-assumed | xargs git update-index --no-assume-unchanged"
unignore-all = !git unskip-all
unskip-all = !cd "$(git rev-parse --show-toplevel)" && git ls-files -v | grep '^S' | awk {'print $2'} | xargs git unskip
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
ignored = !git skip-list
skipped = !git ls-files -v --full-name | grep '^S'
# Recover
recover-stage = !"find $(git rev-parse --show-toplevel)/.git/objects/ -type f -printf '%TY-%Tm-%Td %TH:%TM %P\n' | sort -r | sed 's#/##g' | more -10"
# Merge conflicts
conflicts = diff --name-only --diff-filter=U
ours = "!f() { git co --ours $@ && git add $@; }; f"
theirs = "!f() { git co --theirs $@ && git add $@; }; f"
redo-merge = checkout -m
# Pull requests
pr = "!f() { git fetch -fu ${2:-origin} +pull/$1/head:remotes/origin/pull/$1 && git checkout pr/$1; }; f"
pr-check = "!g() { git pr $1 ${2:-origin} && git reset $(git merge-base HEAD ${2:-origin}/develop); }; g"
guilt = !git-guilt -w
guilt-merge-base = !sh -c 'git guilt $(git merge-base $0 @) @'
# Utils
root = rev-parse --show-toplevel
find = !git ls-files | grep -i
grep-pretty = "!f() { git grep --break --heading $@ $(git rev-list --all); }; f"
check-for-spaces = -c core.whitespace=indent-with-non-tab,trailing-space,space-before-tab,tabwidth=4 diff --check
check-for-tabs = -c core.whitespace=tab-in-indent,trailing-space,space-before-tab,tabwidth=4 diff --check
ls-files = ls-files
merge-base = merge-base
# Workflow-Utils
done = !git fetch origin HEAD && git rebase -i --autosquash origin/HEAD && git rebase origin/HEAD
# Typos
ad = add
comit = commit
dff = diff
statis = status