-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitconfig
271 lines (243 loc) · 8.59 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
271
# set your user tokens as environment variables, such as ~/.secrets
# See https://git-scm.com/docs/git-config
[color]
ui = true
interactive = always
pager = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse
[color "status"]
# normal, black, red, green, yellow, blue, magenta, cyan and white
# italic, strike, bold, dim, ul, blink and reverse
# negate: no-bold, no-italic, ...
header = white normal dim
added = bold yellow
updated = green reverse
changed = blue bold
untracked = bold cyan
nobranch = red white bold
[alias]
# add
a = add # add
chunkyadd = add --patch # stage commits chunk by chunk
# via http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/
snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}"
snapshots = !git stash list --grep snapshot
#via http://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit
recent-branches = !git for-each-ref --count=5 --sort=-committerdate refs/heads/ --format='%(refname:short)'
# branch
b = branch -v # branch (verbose)
# commit
c = commit -m # commit with message
ca = commit -am # commit all with message
ci = commit # commit
cl = commit -eF commit.log # commit with message from file commit.log
av = !git add --all && git commit -av
ammend = commit --amend # ammend your last commit
amend = commit --amend # ammend your last commit
amendf = !git add --all && git commit --amend --no-edit # Use previous message
# checkout
co = checkout # checkout
nb = checkout -b # create and switch to a new branch (mnemonic: "git new branch branchname...")
# cherry-pick
cp = cherry-pick -x # grab a change from a branch
# diff
last = diff HEAD^ # diff last committed change
difftool = difftool --color-words --word-diff
d = difftool
dc = difftool --cached # diff staged changes
dl = difftool HEAD
dll = difftool HEAD~1
kd = difftool -t kdiff3
kdc = difftool --cached -t kdiff3 # diff staged changes
kd = difftool -t kdiff3
kdl = difftool -t kdiff3 HEAD
kdll = difftool -t kdiff3 HEAD~1
fd = difftool -t opendiff
fdl = difftool -t opendiff HEAD
fdll = difftool -t opendiff HEAD~1
fdc = difftool --cached -t opendiff # diff staged changes
md = difftool -t meld
mdl = difftool -t meld HEAD
mdll = difftool -t meld HEAD~1
mdc = difftool --cached -t meld # diff staged changes
pd = difftool -t p4merge
pdl = difftool -t p4merge HEAD
pdll = difftool -t p4merge HEAD~1
pdc = difftool --cached -t p4merge # diff staged changes
# 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\"
simple = log --pretty=format:\" * %s\"
shortnocolor = log --pretty=format:\"%h %cr %cn %s\"
up = !git pull --rebase --prune $@ && git submodule update --init --r
saveme = !git add -A && git commit -m 'SAVEPOINT'
test = "!f(){ git difftool $1~ $1; }; f"
#List commits in short form, with colors and branch/tag annotation
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
# List commits showing changed files
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
ll2 = log --stat --abbrev-commit --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]"
# List oneline commits showing dates
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
# List oneline commits showing relative dates
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
authors = shortlog -sn
# Show all your aliases
la = "!git config -l | grep alias | cut -c 7-"
# pull
pl = pull # pull
rpull = pull --rebase --autostash # git stash && git pull && git pop
# push
ps = push # push
# rebase
rc = rebase --continue # continue rebase
rs = rebase --skip # skip rebase
# remote
r = remote -v # show remotes (verbose)
# reset
unstage = reset HEAD # remove files from index (tracking)
uncommit = reset --soft HEAD^ # go back before last commit, with files in uncommitted state
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
filelog = log -u # show changes to a file
fl = log -u
mt = mergetool -t meld # fire up the merge tool
# stash
ss = stash # stash changes
sl = stash list # list stashes
sa = stash apply # apply stash (restore changes)
sd = stash drop # drop stashes (destory changes)
# status
s = status # status
st = status # status
stat = status # status
# tag
t = tag -n # show tags with <n> lines of each tag message
# helpers
br = branch
lol = log --pretty=oneline --abbrev-commit --graph --decorate
#add
a = !git add . && git add -u && git status
au = !git add -u && git status
aa = !git add . && git add -u && git status
dchanges = difftool develop
exclude = !sh -c 'echo "$1" >> .git/info/exclude' -
# review
review = push origin HEAD:refs/for/develop
# pushl = push -o merge_request.create
pushl = !git push -u origin $(git branch --show current) -o merge_request.create
cot = !git checkout --track origin/$1 -b
[format]
pretty = format:%C(blue)%ad%Creset %C(yellow)%h%C(green)%d%Creset %C(blue)%s %C(magenta) [%an]%Creset
[mergetool]
prompt = true
keepBackup = false
trustExitCode = true
[mergetool "mvimdiff"]
cmd="vim -c 'Gdiff' $MERGED" # use fugitive.vim for 3-way merge
keepbackup=false
[merge]
summary = true
verbosity = 1
tool = diff
[apply]
whitespace = nowarn
[branch]
autosetupmerge = true
autosetuprebase = always
[push]
# 'git push' will push the current branch to its tracking branch
# the usual default is to push all branches
default = tracking
[core]
# for mac set to "input" for dos it should be "true"
autocrlf = input
editor = vim
excludesfile = ~/.gitignore_global
whitespace=fix,-ident-with-non-tab,trailing-space,cr-at-eol
pager = less -JFRSXr
trustctime = false
eol = lf
preloadindex = true
fscache = true
[advice]
statusHints = true
[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
algorithm = MYERS
tool = vimdiff
#external = kdiff3 # for others
#external = /Users/rezasa/bin/git-diff-cmd.sh # for mac
# See the third answer here http://stackoverflow.com/questions/14754762/can-gitconfig-options-be-set-conditionally
merge = vimdiff
[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
[github]
# user = existme
[credential]
credentialStore = secretservice
helper = /usr/bin/gh auth git-credential
# helper = store
# User section moved to the local config file .gitconfig.user
[difftool]
prompt = false
[mergetool "diffmerge"]
cmd = "diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$(if test -f \"$BASE\"; then echo \"$BASE\"; else echo \"$LOCAL\"; fi)\" \"$REMOTE\""
trustExitCode = false
[difftool "idea"]
cmd = idea merge \"$LOCAL\" \"$REMOTE\"
trustExitCode = true
[difftool "diffmerge"]
cmd = diffmerge \"$LOCAL\" \"$REMOTE\"
[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
[gc]
auto = 256
[commit]
template = ~/.stCommitMsg
# move this part to '~/.gitconfig.user'
[user]
email = [email protected]
name = reza-shams-amiri
[fsck]
zeroPaddedFilemode = warn
[url "https://github.com/"]
insteadOf = [email protected]:
[status]
submoduleSummary = 1
[cola]
spellcheck = false
[http "https://se.axis.com"]
proxy = http://wwwproxy.axis.com:3128
[credential "https://github.com"]
helper = !/usr/bin/gh auth git-credential
[credential "https://gist.github.com"]
helper = !/usr/bin/gh auth git-credential
[credential "https://dev.azure.com"]
useHttpPath = true
[url "https://"]
insteadOf = ssh://