-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitconfig
166 lines (146 loc) · 4.76 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
[user]
name = Jonathan Koren
[core]
excludesfile = /Users/jdkoren/.gitignore_global
# For TextWrangler: editor = edit --wait
# For BBEdit: editor = bbedit --wait --resume
# For gedit: editor = gedit -w -s
# For sublime: editor = subl -n -w
[color]
ui = auto
[color "branch"]
upstream = cyan
[push]
default = upstream
[merge]
conflictstyle = diff3
[rebase]
abbreviateCommands = true
autosquash = true
[diff]
algorithm = patience
[rerere]
enabled = true
autoupdate = true
[alias]
# meta
alias = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\\t => \\2/' | less
h = help
# config
user = config user.name
email = config user.email
signkey = config user.signingkey
# usage: g set-user name email
#set-user = !"f() { git config user.name $1; git config user.email $2; }; f"
# status
st = status
stu = status -u # untracked
sti = status --ignored
# log
lo = log --decorate --oneline
la = log --all --decorate --oneline
lg = log --graph --decorate --oneline
lag = log --all --graph --oneline --decorate
lod = log --decorate --pretty=format:'%C(yellow)%h %C(auto)%d %C(reset)%s %C(cyan)<%an> %C(green)%cr'
lad = log --all --decorate --pretty=format:'%C(yellow)%h %C(auto)%d %C(reset)%s %C(cyan)<%an> %C(green)%cr'
lst = log --numstat --no-merges --pretty=format:'%C(yellow)%h %C(reset)%s %C(cyan)<%an> %C(green)%cr%C(white)' # stat
lss = log --shortstat --no-merges --pretty=format:'%C(yellow)%h %C(reset)%s %C(cyan)<%an> %C(green)%cr%C(white)' # shortstat
lm = log --all --decorate --oneline --merges
lmg = log --all --graph --decorate --oneline --merges
l = log --graph --decorate --oneline # copy of la
ll = log --all --graph --decorate --oneline # copy of lag
# navigate
br = !sh -c 'git branch -vv --color $* | grep -v " z-"' -
brr = !sh -c 'git branch -vv -r | grep "$1"' - # remote branches
rbr = !sh -c 'git branch -vv -r | grep "$1"' - # remote branches
co = checkout
cob = checkout -b
dbr = branch -D # delete branch
brd = branch -D # delete branch
# stash
sa = stash apply
sc = stash clear
sd = stash drop
sl = stash list
sp = stash pop
ss = stash save
# inspect
df = diff
dfs = diff --staged
diffn = diff --no-ext-diff
# stage
a = add
aa = "!f() { git add `git rev-parse --show-toplevel`; }; f" # add all, not add .
ai = add -i # interactive
ap = add -p
an = add -N
aan = "!f() { git add -N `git rev-parse --show-toplevel`; }; f" # add -N all, not add -N .
u = reset HEAD # unadd/unstage
up = reset -p
# commit
c = commit
cm = commit -m
ca = commit -a
cam = commit -am
cs = commit -S
cas = commit -a -S
cms = commit -S -m
cams = commit -a -S -m
csq = commit --squash
cfu = commit --fixup
amend = commit --amend
fixup = commit --amend --no-edit
fu = commit --amend --no-edit # fixup
vc = verify-commit
# push, pull
purr = pull --rebase
pup = push --set-upstream
puff = push -f
pnv = push --no-verify
# rebase
rb = rebase
rbi = rebase --interactive
rba = rebase --abort
rbc = rebase --continue
rbs = rebase --skip
# merge
m = merge --no-ff
mff = merge --ff-only
mnc = merge --no-ff --no-commit
mp = merge -s recursive -X patience
cp = cherry-pick
cpn = cherry-pick --no-commit
cpc = cherry-pick --continue
cpa = cherry-pick --abort
# reset
re = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
# remote
r = remote
rv = remote -v
f = fetch
# bisect
bi = bisect
big = bisect good
bib = bisect bad
bis = bisect start HEAD # HEAD is bad, $1 (if present) is good
bir = bisect reset
bil = bisect log
# submodules
smu = submodule update --recursive --remote
# "checkout pull request": fetch a pull request and check it out as a local branch
# usage: 'git copr 123' checks out pull request #123 as branch 'pr_123'
copr = !"f() { git show-ref -q --verify refs/heads/pr_$1; if [ $? -ne 0 ] ; then git fetch origin refs/pull/$1/head:pr_$1; git checkout pr_$1; else git checkout pr_$1; git pull --rebase origin refs/pull/$1/head; fi; }; f"
# commit info where file was added
whoadded = log --follow --diff-filter=A --
# commit info where file was removed
whoremoved = log --follow --diff-filter=D --
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
# log commits to be added if merging with $1
lup = !git merge-base HEAD $1 | git lo $1..