-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
259 lines (236 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
# set your user tokens as enivornment variables, such as ~/.secrets
# See the README for examples.
[color]
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[alias]
#pr's
# git config --global alias in e.g. .zshrc will override these!
pr = !git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$1 && :
pr-clean = "!git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done"
# add
a = add . # add everything to the staging area
chunkyadd = add --patch # stage commits chunk by chunk
# branch
b = branch -v # branch (verbose)
bn = !sh -c 'git rev-parse --abbrev-ref HEAD' # gets the name of the branch
bm = branch -m # rename branch
# commit
c = commit -m # commit with message
ca = commit -am # commit all with message
cf = commit --fixup # create fixup commit
ci = commit # commit
cn = commit -n # commit with no hooks
cnf = commit -n --fixup # create fixup commit with no hooks
cnfr = "!cnfr() { git cnf $1 && git ras $1^; }; cnfr" # create fixup commit with no hooks, and immediately rebase with autosquash from the commit before the destination
aci = !git add . && git commit # add everything commit
acn = !git add . && git commit -n # add everything _and_ commit with no hooks
acf = !git add . && git commit --fixup # add everything and create fixup commit
acnf = !git add . && git commit -n --fixup # add everything and create fixup commit (don't run hooks)
acnfr = "!acnfr() { git acnf $1 && git ras $1^; }; acnfr" # add everything, create fixup commit with no hooks, and immediately rebase with autosquash from the commit before the destination
amend = commit --amend # amend your last commit
namend = commit --amend -n # amend your last commit with no hooks
anamend = commit -a --amend -n # like namend, but stage all changes before commmit
amen = commit --amend --no-edit # amend your last commit without prompting for the commit message
namen = commit --amend --no-edit -n # like amen, but skip commit hooks
anamen = commit -a --amend --no-edit -n # like namen, but stage all changes before commmit
# checkout
co = checkout # checkout
cof = !sh -c 'git-fuzzy-checkout $1' - # fuzzy vheckout e.g. `git cof refact` instead of `git co refactoring`
cot = !sh -c 'git fetch origin && git checkout -t origin/$1' -
cob = !sh -c 'git checkout origin/`git bn`'
coba = !sh -c 'git checkout base'
nb = checkout -b # create and switch to a new branch (mnemonic: "git new branch branchname...")
com = checkout master # checkout master
coma = checkout main # checkout main
cod = checkout development # checkout development
cos = checkout staging # checkout staging
coh = checkout HEAD^ # checkout the commit before the last
# cherry-pick
cp = cherry-pick -x # grab a change from a branch
# diff
d = diff # diff unstaged changes
dc = diff --cached # diff staged changes
last = diff HEAD^ # diff last committed change
# fetch
fu = fetch upstream
fo = fetch origin
fomom = !git fetch origin && git merge origin/master
fomoma = !git fetch origin && git merge origin/main
fomos = !git fetch origin && git merge origin/staging
fomod = !git fetch origin && git merge origin/development
forhob = !git fetch origin && git reset --hard origin/`git bn`
forhom = !git fetch origin && git reset --hard origin/master
forhoma = !git fetch origin && git reset --hard origin/main
forhos = !git fetch origin && git reset --hard origin/staging
forhod = !git fetch origin && git reset --hard origin/development
# log
l = log --graph --date=short
changes = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\" --name-status
short = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\"
changelog = log --pretty=format:\" * %s\"
shortnocolor = log --pretty=format:\"%h %cr %cn %s\"
#ls
ls = diff-tree --no-commit-id --name-only -r
# merge
mom = merge origin/master
moma = merge origin/main
mos = merge origin/staging
# pull
pl = pull
prod = pull --rebase origin development
prom = pull --rebase origin master
proma = pull --rebase origin main
pros = pull --rebase origin staging
prob = !sh -c 'git pull --rebase origin `git bn`'
prios = !sh -c 'git pull --rebase origin staging && git rebase -i origin/staging'
prasom = !sh -c 'HUSKY_SKIP_HOOKS=1 git fetch origin && git rebase --autosquash --interactive origin/master'
priom = !sh -c 'git pull --rebase origin master && git rebase -i origin/master'
prioma = !sh -c 'git pull --rebase origin master && git rebase -i origin/main'
prud = pull --rebase upstream development
prum = pull --rebase upstream master
prus = pull --rebase upstream staging
# push
ps = push
fp = !sh -c 'git push --force origin `git bn`' -
fpn = !sh -c 'git push --force --no-verify origin `git bn`' -
fpu = !sh -c 'git push --force upstream `git bn`' -
fpc = !sh -c 'git push --force codazzo `git bn`' -
fpp = !sh -c 'git push --force play `git bn`' -
fpcn = !sh -c 'git push --force --no-verify codazzo `git bn`' -
fpa = !sh -c 'git push --force adettole `git bn`' -
# rebase
ra = rebase --abort
ras = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase --autosquash --interactive $0'
rasom = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase --autosquash --interactive origin/master'
rasoma = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase --autosquash --interactive origin/main'
rasos = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase --autosquash --interactive origin/staging'
rasod = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase --autosquash --interactive origin/development'
rasob = !sh -c 'git rebase --autosquash --interactive origin/`git bn`'
rasoba = !sh -c 'git rebase --autosquash --interactive base'
rc = rebase --continue
arc = !git add . && git rebase --continue
rs = rebase --skip
ri = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase -i HEAD~$1' -
riod = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase -i origin/development'
rios = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase -i origin/staging'
riob = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase -i origin/`git bn`'
rioba = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase -i base'
riom = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase -i origin/master'
rioma = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase -i origin/main'
robid = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase origin/`git bn` --ignore-date'
robaid = !sh -c 'HUSKY_SKIP_HOOKS=1 git rebase base --ignore-date'
romid = rebase origin/master --ignore-date
rosid = rebase origin/staging --ignore-date
rodid = rebase origin/development --ignore-date
# remote
rpo = remote prune origin
rpod = remote prune origin --dry-run
# reset
unstage = reset HEAD # remove files from index (tracking)
us = reset HEAD
uncommit = reset HEAD^ # go back before last commit, with files in uncommitted state
uc = reset HEAD^
filelog = log -u # show changes to a file
mt = mergetool # fire up the merge tool
r = !sh -c 'git reset HEAD~$1' -
rh = reset --hard
rod = reset origin/development
ros = reset origin/staging
rom = reset origin/master
rob = !git fetch origin && git reset origin/`git bn`
roma = reset origin/main
rhom = reset --hard origin/master
rhos = reset --hard origin/staging
su = !sh -c 'git branch --set-upstream-to=origin/`git bn`'
# stash
ss = stash save --include-untracked # stash changes - including untracked files
sl = stash list # list stashes
sp = stash pop # pop stash
sa = stash apply # apply stash (restore changes)
sd = stash drop # drop stashes (destory changes)
# status
s = status # status
st = status # status
stat = status # status
changed = !git status --porcelain | sed s/^...//
# tag
t = tag -n # show tags with <n> lines of each tag message
#wip
wip = !git add . && git commit -n -m "WIP"
sfsg = !git add . && git commit -n -m "SFSG"
# svn helpers
svnr = svn rebase
svnd = svn dcommit
svnl = svn log --oneline --show-commit
#recent branches
rbr = for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)'
rb = !sh -c 'git rbr | tac'
cb = !git checkout `git rbr | fzf`
[format]
pretty = format:%C(blue)%ad%Creset %C(yellow)%h%C(green)%d%Creset %C(blue)%s %C(magenta) [%an]%Creset
[mergetool]
prompt = false
keepBackup = true
[mergetool "mvimdiff"]
cmd="mvim -c 'Gdiff' $MERGED" # use fugitive.vim for 3-way merge
keepbackup=false
[merge]
summary = true
verbosity = 1
tool = mvimdiff
conflictstyle = diff3
[apply]
whitespace = nowarn
[branch]
autosetupmerge = true
[push]
# 'git push' will push the current branch to its tracking branch
# the usual default is to push all branches
default = current
[core]
autocrlf = false
editor = subl -n -w
excludesfile = ~/.gitignore_global
[advice]
statusHints = false
[diff]
# Git diff will use (i)ndex, (w)ork tree, (c)ommit and (o)bject
# instead of a/b/c/d as prefixes for patches
# mnemonicprefix = true
[rerere]
# Remember my merges
# http://gitfu.wordpress.com/2008/04/20/git-rerere-rereremember-what-you-did-last-time/
enabled = true
[include]
path = .gitconfig.user
[user]
name = Antonio D'Ettole
email = [email protected]
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[commit]
template = ~/.stCommitMsg
[include]
path = ~/.gitconfig.include[fetch]
[fetch]
prune = true
[pull]
rebase = false