forked from theskumar/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
250 lines (192 loc) · 6.41 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
[include]
path = ~/.private/.gitconfig
[alias]
# Delete all locally merged branches, except master, dev, qa, prod
bclean = "!f() { git branch --merged ${1-master} | egrep -v 'master|dev|qa|prod' | xargs -n 1 git branch -d; }; f"
bdone = "!f() { git checkout ${1-master} && git up && git bclean ${1-master}; }; f"
c = commit -am
ci = commit -v
cia = commit --amend -va
cp = cherry-pick
cpc = cherry-pick --continue
cpa = cherry-pick --abort
cpq = cherry-pick --quit
ec = config --global -e
r = reset
rh = reset --hard
rt = remote -v
rad = remote add
rem = rebase origin/master
rrm = remote rm
rpr = remote prune
rre = remote rename
rsu = remote set-url
br = branch -v
bD = branch -D
bM = branch -M
bra = branch -va
bru = branch -u
p = push
g = grep -p
b = blame -M -CC
h = help
cl = clone
s = status -sb
co = checkout
cob = checkout -b
cm = checkout master
re = rebase
ri = rebase -i
rim = rebase -i master
rc = rebase --continue
ra = rebase --abort
rs = rebase --skip
ss = stash save
sp = stash pop
sd = stash drop
sc = stash clear
sad = submodule add
df = diff --color --color-words --abbrev
l = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
lg = log -p
sl = log --stat --format=oneline --abbrev-commit
simple = log --pretty=format:\" * %s\"
fixup = !sh -c 'git commit -m \"fixup! $(git log -1 --format='\\''%s'\\'' $@)\"' -
squash = !sh -c 'git commit -m \"squash! $(git log -1 --format='\\''%s'\\'' $@)\"' -
ri = rebase --interactive --autosquash
who = !echo \"== Commits by Author:\\n`git shortlog -s -n`\\n\"
up = !sh -c 'git pull --rebase --prune $@ && git submodule update --init --recursive && git log --pretty=format:\"%Cred%ae %Creset- %C(yellow)%s %Creset(%ar)\" HEAD@{1}..'
f = fetch
fo = fetch origin
fa = fetch --all
conf = config --list
t = tag -n
td = tag -d
# Display the number of commits per author in numerical order
who = shortlog -sne --no-merges
today = !git log --since=midnight --author=\"$(git config user.name)\" --oneline
yesterday = !git log --since=\"2 day ago\" --until=midnight --author=\"$(git config user.name)\" --oneline
ls = ls-files
# Switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
recent = "!r() { cur=$(git rev-parse --abbrev-ref HEAD); git for-each-ref --sort=-committerdate refs/heads/ --format='%(color:yellow)%(refname:short)|%(color:bold green)%(committerdate:relative)|%(color:blue)%(subject)|%(color:magenta)%(authorname)%(color:reset)' | sed \"s/m${cur}|/m* ${cur}|/\" | column -ts'|'; }; r"
# File level ignoring
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
apply-gitignore = "!git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached"
# snapshot stashes
snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}"
# merging
ours = "!f() { git checkout --ours $@ && git add $@; }; f"
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f"
# GitHub Pull Request Management
pr = "!f() { git fetch -fu origin refs/pull/$1/head:pr/$1; } ; f"
# Merge GitHub pull request on top of the current branch or,
# if a branch name is specified, on top of the specified branch
mpr = "!f() { \
declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \
declare branch=\"${2:-$currentBranch}\"; \
if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \
git fetch origin refs/pull/$1/head:pr/$1 && \
git checkout -B $branch && \
git rebase $branch pr/$1 && \
git checkout -B $branch && \
git merge pr/$1 && \
git branch -D pr/$1 && \
git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \
fi \
}; f"
reauthor = !sh -c 'eval `git log --reverse --topo-order --pretty=format:\"git cherry-pick -m 1 %H && git commit --amend -C %H --author=\\\"%aN <%aE>\\\" && \" $0 ` "echo success" '
# Initialize git in a better way
# Adds .gitattributes, .gitignore and Readme.md file
ini = "!f() { git init && echo \"* text=auto\" >> .gitattributes && touch .gitignore README.md && git status; }; f"
switch = !legit switch \"$@\"
branches = !legit branches
sprout = !legit sprout \"$@\"
unpublish = !legit unpublish \"$@\"
harvest = !legit harvest \"$@\"
sync = !legit sync \"$@\"
publish = !legit publish \"$@\"
graft = !legit graft \"$@\"
[color]
ui = auto
[core]
excludesfile = ~/.gitignore
attributesfile = ~/.gitattributes
filemode = false
autocrlf = false
ui = auto
# Treat spaces before tabs and all kinds of trailing whitespace as an error
# [default] trailing-space: looks for spaces at the end of a line
# [default] space-before-tab: looks for spaces before tabs at the beginning of a line
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
# Make `git rebase` safer on OS X
# More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/>
trustctime = false
# Editor used for writing git commits
editor = subl -n -w
[diff]
tool = vimdiff
submodule = log
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[merge]
log = true
tool = vimdiff
[rebase]
autosquash = true
autostash = true
[remote "origin"]
receivepack = git receive-pack
[status]
short = true
branch = true
[log]
date = relative
mailmap = true
[grep]
lineNumber = true
[blame]
date = relative
blankboundary = true
showroot = true
[pull]
rebase = true
[push]
default = current
[format]
signoff = true
coverLetter = auto
[commit]
template = ~/.gitmessage
[url "[email protected]:"]
insteadOf = "gh:"
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
[url "git://github.com/"]
insteadOf = "github:"
[url "[email protected]:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
[url "git://gist.github.com/"]
insteadOf = "gist:"
# Any GitHub repo with my username should be checked out r/w by default
# http://rentzsch.tumblr.com/post/564806957/public-but-hackable-git-submodules
[url "[email protected]:theskumar/"]
insteadOf = "git://github.com/theskumar/"
[filter "media"]
clean = git-media-clean %f
smudge = git-media-smudge %f