forked from nicksp/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitconfig
296 lines (239 loc) · 8.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
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# A good list of alises http://haacked.com/archive/2014/07/28/github-flow-aliases/
[alias]
# Bisect
biscuit = bisect
# Staging
a = add
aa = add --all
# Branch
br = branch
branch-name = rev-parse --abbrev-ref HEAD
branch-diff = diff master...HEAD
branch-files = "!git diff master...HEAD --name-status | sed '/^D/d ; s/^.\\s\\+//'"
# Commit
c = commit
ca = commit -a
cm = commit -m
cal = !git add -A && git commit # Commit all changes
cam = commit -am
cne = commit --no-edit
amend = commit --amend
amend-all = !git add --all && git commit --amend --reuse-message=HEAD
# Clone
cl = clone
sclone = clone --depth=1
# Checkout
co = checkout
cb = checkout -b
# Cherry-pick
cp = cherry-pick
# Diff
d = diff --color-words
dc = diff --cached
df = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
# Merge
m = merge
# Pull
up = pull
plom = pull origin master
plum = pull upstream master
preb = !git fetch upstream && git rebase upstream/master
# Push
p = push
pom = push origin master
poh = push origin head
# Stash
st = stash
stp = stash pop
# Status/Logging
s = status
ss = status -sb
hist = log --graph --pretty=custom # Show custom graph
l = log --pretty=custom # Show custom log
ll = log --stat --abbrev-commit
lc = shortlog --summary --numbered # List contributors
# Reset
unstage = reset HEAD -- # Mixed reset (affects HEAD and Index)
undo = reset --soft HEAD~1 # Undo last commit (affects HEAD only)
reset = reset --hard HEAD~1 # Remove last commit (from HEAD, Index and Working Dir)
# Remote
r = remote -v
# Submodules
subpl = submodule update --init --recursive
# Git flow
new = !git pull origin develop && git flow feature start
done = !git pull origin develop && git flow feature finish "$(git symbolic-ref --short HEAD | sed -n 's/^feature\\///p')"
go = !git checkout $1 && pull
master = !git checkout master && pull
develop = !git checkout develop && pull
mmm = !git fetch origin master && git rebase origin/master
ddd = !git fetch origin develop && git rebase origin/develop
# Misc
publish = "!git push --set-upstream origin $(git branch-name)"
# https://metalelf0.github.io/git/2014/07/12/git-preview-conflicts-without-touching-the-working-copy.html
# check how the merge of dev into master will go:
# git dry dev master
dry = "!f() { git merge-tree `git merge-base $2 $1` $2 $1; }; f"
# see if there will be any conflicts merging dev into master:
# git conflicts dev master
conflicts = "!f() { git merge-tree `git merge-base $2 $1` $2 $1 | grep -A3 'changed in both'; }; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Find commits by source code
cc = "!f() { \
git log --pretty=custom --decorate --date=short -S\"$1\"; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Find commits by commit message
cm = "!f() { \
git log --pretty=custom --decorate --date=short --grep=\"$1\"; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Credit an author on the latest commit
credit = "!f() { \
if [ -n \"$1\" ] && [ -n \"$2\" ]; then \
git commit --amend --author \"$1 <$2>\" -C HEAD; \
fi \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# List remote branches
lrb = "!f() { \
remote="${1:-origin}"; \
git ls-remote --heads "$remote"; \
}; 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\nClose #$1\"; \
fi \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Remove the tag with the specified tag name if
# exists and tag the latest commit with that name
retag = "!f() { \
git tag -d "$1" &> /dev/null; \
git tag $1; \
}; f"
forget = update-index --skip-worktree
remember = update-index --no-skip-worktree
upstream = !git branch --set-upstream-to=origin/$(git rev-parse --abbrev-ref HEAD) $(git rev-parse --abbrev-ref HEAD)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# So much color
[color]
ui = auto
[color "branch"]
current = green bold
local = green
remote = yellow
[color "diff"]
frag = magenta
meta = yellow
new = green
old = red
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = "red bold 52"
newNormal = "green bold"
newHighlight = "green bold 22"
[color "status"]
added = green reverse
changed = yellow reverse
untracked = red reverse
# Git mergetool
[merge]
tool = opendiff
conflictstyle = diff3
[core]
editor = vim
abbrev = 12
attributesfile = ~/.gitattributes
excludesfile = ~/.gitignore
autocrlf = input
mergeoptions = --no-edit
ignorecase = false
pager = delta
[delta]
line-numbers = true
plus-style = "syntax #012800"
minus-style = "syntax #340001"
syntax-theme = Monokai Extended
navigate = true
side-by-side = true
navigate = true
light = false
[interactive]
diffFilter = delta --color-only
[diff "bin"]
# Use `hexdump` to diff binary files
textconv = hexdump -v -C
colorMoved = default
[pretty]
custom = "%C(magenta)%h%C(red)%d %C(yellow)%ar %C(green)%s %C(yellow)(%an)"
# │ │ │ │ └─ author name
# │ │ │ └─ message
# │ │ └─ date (relative)
# │ └─ decorations (branch, heads or tags)
# └─ hash (abbreviated)
[help]
# Correct typos
autocorrect = 1
# 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]:tnorthcutt/"]
insteadOf = "git://github.com/tnorthcutt/"
# Rewrites of repo paths
[url "[email protected]:"]
insteadOf = "gh:"
insteadOf = "git://github.com"
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
pushInsteadOf = "https://github.com/"
[url "git://github.com/"]
insteadOf = "github:"
[url "[email protected]:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
pushInsteadOf = "https://gist.github.com/"
[url "git://gist.github.com/"]
insteadOf = "gist:"
# Push easily http://stackoverflow.com/a/23918418/89484
[push]
# Make `git push` automatically push relevant
# annotated tags when pushing branches out
followTags = true
default = current
# Use separate file for username / github token / etc
[include]
path = ~/.gitconfig.local
[fetch]
prune = true
[init]
templatedir = ~/.git_template
defaultBranch = main
[gui]
recentrepo = /Users/travis/Sites/groups/wp-content/plugins/wc-group-memberships
recentrepo = /Users/travis/Sites/chi
[github]
user = tnorthcutt
[ghi]
token = !security find-internet-password -a tnorthcutt -s github.com -l 'ghi token' -w
[user]
name = Travis Northcutt
email = [email protected]
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[rerere]
enabled = true