-
Notifications
You must be signed in to change notification settings - Fork 1
/
gitconfig
192 lines (154 loc) · 4.74 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
[alias]
st = status
co = checkout
coc = checkout .
cob = checkout -b
cobf = "!f() { git brd $1; git cob $1; }; f"
col = checkout HEAD~1
ours = checkout --ours
theirs = checkout --theirs
aours = "!f() { (git reset $* >/dev/null); git ours $* && git add $*; }; f"
atheirs = "!f() { (git reset $* >/dev/null); git theirs $* && git add $*; }; f"
ci = commit
cia = commit -a
cam = commit --amend
cl = clean
cldf = clean -df
res = reset
resa = reset HEAD
resh = !git stash && git reset --hard
reshh = !git stash && git reset --hard HEAD
cundo = reset HEAD^1
cundoh = !git stash && git reset HEAD^1 --hard
unstage = reset HEAD
tags = tag -l
s = show --color
sf = show --color --name-only
d = diff --color
dw = diff --color -w
ds = diff --color --staged
dsf = diff --color --staged --name-only
df = diff --color --name-only
f = fetch
fa = fetch --all
fo = fetch origin
m = merge
unm = reset --merge
ps = push
psu = push -u
psf = push -f
pso = push origin
pssm = push --recurse-submodules=on-demand
psremoveallbranches = "!f() { git push $1 `git brar $1 | grep -v master | xargs -I {} echo :{}`; }; f"
pl = pull
plo = pull origin
plom = pull origin master
plr = pull --rebase
unmerged = !git ls-files --unmerged | cut -f2 | uniq
untracked = ls-files --other --exclude-standard
staged = ls-files --staged
modified = ls-files --modified
deleted = ls-files --deleted
gitignored = ls-files -o -i --exclude-standard
sig = !git ls-files -v | grep "^[[:lower:]]"
ig = update-index --assume-unchanged
uig = update-index --no-assume-unchanged
ignore = update-index --assume-unchanged
ignored = !git sig
gitignore-untracked = !git gitignore `git untracked`
ig-untracked = !git ignore `git untracked`
gitignore = !cd `git root` && touch .gitignore
lp = log -p --color
lf = log -p --name-only --color
lnom = log --color --no-merges
lg = log --graph --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr) %Cblue%an <%ae>%Creset' --abbrev-commit --date=relative
lg2 = !source ~/.githelpers && pretty_git_log
lgp = !git lg -p --color
lgf = !git lg -p --name-only --color
l = log --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr) %Cblue%an <%ae>%Creset' --abbrev-commit --date=relative
lc = "!f() { git log $* | grep '^commit ' | cut -f 2 -d ' '; }; f"
head = !git l -1
h = !git head
hp = !source ~/.githelpers && show_git_head
r = !git l -20
ra = !git r --all
pg = diff
pgs = diff --staged
pa = apply
sh = stash
sha = stash apply
shl = stash list
shc = stash clear
chp = cherry-pick
chpc = cherry-pick --continue
chpq = cherry-pick --quit
chpa = cherry-pick --abort
aa = add -A
a = add
ap = add -p
resolve-unmerged = !git add `git unmerged`
add-untracked = !git add `git untracked`
as = !git diff -w --no-color | git apply --cached
rs = !(git resa && git as && git co . && git resa) &>/dev/null
am3 = am -3
amr = am --resolved
amc = am --continue
ama = am --abort
ams = am --skip
fm = format-patch
rmf = rm -rf
rb = rebase
rbi = rebase -i
rbc = rebase --continue
rba = rebase --abort
rbs = rebase --skip
mt = mergetool
vm = !vim `git unmerged`
vmo = !vim `git modified`
vt = !vim `git untracked`
vim-unmerged = !git vm # deprecated
current = rev-parse --abbrev-ref HEAD
br = branch
brt = branch --track
brup = branch --set-upstream
bra = !git branch -a | less
brar = "!f() { git bra | grep remotes/$1/ | cut -f 3 -d '/'; }; f"
brd = branch -D
brc = branch --contains
brcommits = "!f() { git lc --branches=$1* }; f"
brdiff = !source ~/.githelpers && diff_branches
brfdiff = !source ~/.githelpers && diff_branches_show_files
rem = remote
rema = remote add
remr = remote rm
remv = remote -v
remotes = remote -v
sm = submodule
smst = submodule --status
sma = submodule add
smu = submodule update
smui = submodule update --init
smuir = submodule update --init --recursive
sms = submodule sync
bl = blame
gcp = gc --prune=now
gca = gc --aggressive
gcap = gc --aggressive --prune=now
# git change-commits GIT_COMMITTER_NAME "old name" "new name"
change-commits = "!f() { VAR=$1; OLD=$2; NEW=$3; shift 3; git filter-branch --env-filter \"if [[ $`echo $VAR` = \\\"$OLD\\\" ]]; then export $VAR=\\\"$NEW\\\"; fi\" $@; }; f"
# from https://help.github.com/articles/remove-sensitive-data
remove-file = "!f() { git filter-branch -f --index-filter \"git rm --cached --ignore-unmatch $1\" --prune-empty --tag-name-filter cat -- --all; }; f"
rf = reflog
rfe = reflog expire --expire=now --all
pr = prune
prm = !git rfe && git gcp
[color]
interactive = true
branch = true
status = true
[core]
pager = less -iRS
[pager]
diff = true
status = true
show-branch = true