-
Notifications
You must be signed in to change notification settings - Fork 1
/
gitconfig
311 lines (291 loc) · 13 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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# canonical-repository: [email protected]:rpasay/dotfiles.git
# description: Ripta Pasay's gitconfig
# author: Ripta Pasay <[email protected]>
# last-modified: 2023-01-06T19:44:38-0800
# ---
# Stop giving me noob warnings; I know what a non-ff push is, and I know what
# unstaged changes are. Set these to true for more user-friendly messages.
[advice]
commitBeforeMerge = false
detachedHead = false
pushNonFastForward = false
resolveConflict = false
skippedCherryPicks = false
statusHints = false
# Useful aliases:
[alias]
a = add --all ; add should include untracked and deleted
ae = add --edit ; advanced editing of staged hunks
ai = add -i ; in interactive mode
ap = add -p ; in interactive-patch mode
au = add --update ; only on tracked files
b = branch ; branch
ba = branch -a ; all (remote and local)
bac = branch -a --contains ; those containing a commit
bc = branch --contains ; local ones containing a commit
bd = branch -d ; delete, safely
bdf = branch -D ; delete, forcefully
bm = branch --merged ; other branches merged into current
bnm = branch --no-merged ; other branches *not* merged into current
br = branch -r ; remote-only
brd = branch -r -d ; delete
brm = branch -r --merged ; that have been merged into current
bv = branch -v ; and show latest commit on them
cfd = clean -fd ; cleanup any stray files
ci = commit ; commit normally
cia = commit --amend ; amend the last commit
cif = commit --fixup ; with fixup against a commit
cig = commit --allow-empty --signoff
; with a goodness mark
cl = clone ; clone
cmp = "!f() { git log $1..$2; }; f"
; compare two refs
cni = cherry -v ; cherry (commits-not-in)
co = checkout ; checkout
cob = checkout -b ; while creating new branch
cot = checkout --track ; and set up branch tracking
cotb = checkout --track -b ; while creating new branch
count = shortlog -sn --no-merges
; shortlog summary with commit count (no merges)
cp = cherry-pick -x ; cherry-pick (mnemonic: copy, cp)
cra = commit --amend --reset-author ; reset author
cram = commit --amend --reset-author --no-edit ; reset author keep commit
dc = diff --cached ; diff staged changes vs index
di = diff ; working tree vs index
dis = diff --stat=200,120 ; but only filenames
diw = diff --word-diff ; working tree vs index with word-level diffs
dt = diff-tree ; diff two tree-object blobs
dw = diff --word-diff ; word-wise diff
fb = filter-branch ; DESTRUCTIVE filtering of branches...
fbc = filter-branch --commit-filter ; rewrite commit objects
fbi = filter-branch --index-filter ; rewrite the index
fbm = filter-branch --msg-filter ; rewrite commit messages
fbp = filter-branch --parent-filter ; rewrite commit parent SHA1s
fbt = filter-branch --tree-filter ; rewrite an entire tree
fm = "!sh -c 'commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2'"
; https://stackoverflow.com/questions/8475448
fp = format-patch ; generate mailbox patches
fo = fetch origin ; fetch from origin
foco = "!f() { git fetch origin && git checkout $1 && git pull --ff-only; }; f"
; ... and checkout and pull (no merges)
fpo = fetch --prune origin ; and prune deleted branches
fu = fetch upstream ; for a secondary remote
gca = gc --aggressive ; explicitly run garbage collection and repacking
l = log ; logs of current branch
lc = local-commits ; unpushed changes - required git-local-commits
ld = log --pretty=oneline --decorate
; decorated
lg = log --all --graph --decorate --oneline --simplify-by-decoration
; decorated graph
lh = log --pretty='format:%h %s'
; abbreviated non-colored short-hash w/ msg
lf = log --pretty=full ; w/ author and committer
lff = log --pretty=fuller ; w/ author, committer, and timestamps
lme = !git log --author=$(git config user.email) || exit 0
; just mine, and always succeed
lnm = log --no-merges ; without merge commits
lol = !echo 🙃
lost = fsck --cache --no-reflogs --lost-found --unreachable HEAD
; find anything unreachable by any means
; (cache, reflogs, refs)
lp = log --patch ; generate patch
ls = ls-files ; list all files in repository
lsd = ls-files --deleted ; only deleted
lz = !lazygit
m = merge --no-ff ; merge, disallow fast-foward
mff = merge --ff-only ; only allow fast-forward
mffs = merge --ff-only --squash
mis = merge --no-ff -Xignore-space-change
; ignore whitespace changes
mr = merge-reviewed ; merge a reviewed branch
mrns = merge -s recursive -Xignore-space-change
; recursively, no space
mt = mergetool ; see [mergetool]
n = tag --force _notch HEAD ; notch mark on HEAD
nc = log --patch --reverse --topo-order _notch..HEAD
; find difference between last notch and HEAD
noa = notes add
nol = notes list
nos = notes show
pr = pull --rebase ; pull, with rebase
ps = push -q ; push
psd = push --delete
psf = push --force-with-lease ; force
pso = push origin ; to origin
pst = push --tags ; just tags
psu = push -u origin ; and set up upstream tracking
psub = !git push -u origin `git symbolic-ref --short HEAD`
r = rev-parse --show-toplevel ; root of git repo
rb = rebase ; rebase
rba = rebase --abort ; abort
rbc = rebase --continue ; continue
rbi = rebase -i ; in interactive mode
rbia = rebase -i --autosquash
rbs = rebase --skip ; skip change
re = remote -v ; remote destinations
rea = remote add ; add
rli = rev-list ; rev-list
rlo = reflog ; reflog
rmls = deleted-files ; find deleted files, requires git-deleted-files
rp = rev-parse
rpa = repack -A ; repack, keeping unreachable objects loose
; cleanup using "git gca"
rpo = remote prune origin ; prune local branches that are tracking deleted
; remote branches
rs = reset ; reset the tip and index, but not the working tree
rsh = reset --hard ; reset the tip, index, AND working tree
rss = reset --soft ; reset the tip
rsoh = reset --hard ORIG_HEAD
; reset the tip, index, and tree to before a
; destructive operation, like a merge
rv = revert ; revert a commit
rvne = revert --no-edit ; for sure
sa = stash ; stash the working tree
saa = stash apply ; apply stash onto working tree
sal = stash list ; list stashes
sap = stash pop ; pop goes the stash
sh = show ; show a change
shc = show --color=always ; always with color
shs = show --stat ; list the files changes
sma = submodule add ; submodule add
sob = sign-off-branch ; sign all commits on specific branch
stb = "!git sign-off-branch $(git symbolic-ref --short HEAD)"
; on checked-out branch
sr = symbolic-ref ; symbolic ref dump
srrm = symbolic-ref -d ; delete
st = status --short ; status of working tree
ss = submodule sync ; submodule sync
surm = !git submodule update --remote --merge
ssr = !git submodule sync && git submodule update --init --recursive
; submodule sync (recursive)
sync = !git pr && git ps ; sync = pull --rebase and push
t = tag ; tag
ta = tag -a ; annotated
tme = !git lme --no-merges --stat --name-only --pretty=format:'' | sort -u
; touchlist: files I have modified
ur = update-ref ; update sym ref safely
wc = whatchanged ; what files changed
wcme = !git whatchanged --author=$(git config user.email) || exit 0
; by me, and always succeed
wn = log -p HEAD@{1}..HEAD@{0}
; what's new between reflog 1 and 0
xb = blame ; x-blame
xd = describe ; x-describe branch by closest tag
# Applying a patch should fix whitespace errors (but also output a warning
# when doing so).
[apply]
whitespace = fix
# "cot" and "cotb" are probably useless now, because autosetupmerge will take
# care of tracking branches automatically. While this is the default in newer
# git, this is here to emulate the behavior in older ones.
[branch]
autosetupmerge = true
# Color output whenever possible with special colors to make it look nice
# against the "solarized" color scheme.
[color]
branch = auto
diff = auto
status = auto
ui = auto
[color "branch"]
current = green reverse
local = green
remote = yellow
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
# Set the darn editor and pager, which unfortunately don't always get picked
# up in some versions of git.
[core]
editor = nvim
excludesfile = ~/.dotfiles/gitignore
pager = $PAGER -FX
preloadindex = true
# Diffing settings galore.
[diff]
algorithm = patience
mnemonicprefix = true ; diffs should show location instead of generic
; a, b filenames
renames = copies ; renames should be treated as copies
# tool = Kaleidoscope.app ; Kaleidoscope is the shizz (but Mac-only)
wordRegex = [^[:space:]] ; a word is any non-space (unicode?)
[difftool]
prompt = true ; always ask by default
[difftool "Kaleidoscope.app"]
cmd = ksdiff-wrapper git \"$LOCAL\" \"$REMOTE\"
# Matchy-matchy with my prompt.
[format]
pretty = format:%Cgreen%h %Cblue%G? %ae %Creset%s
# GitHub settings
[github]
user = ripta
# Don't automatically garbage collect, because it will sometimes block
# large operations for a long time. Run "git gc" to manually clean up.
[gc]
auto = 0
[init]
defaultBranch = main
# Merge settings and tools.
[merge]
conflictstyle = diff3
stat = true ; always show a diffstat after a merge
tool = vimdiff
[mergetool]
keepBackup = false
[mergetool "splice"]
cmd = "vim -f $BASE $LOCAL $REMOTE $MERGED -c 'SpliceInit'"
trustExitCode = true
# Push the current branch to the upstream branch
[push]
default = upstream
# Just-don't-even autostash before rebasing.
[rebase]
autoStash = false
# Prefer smaller packed objects, even if it means no love for git before 1.4.4.
# Also no love for: http and rsync repositories.
[repack]
usedeltabaseoffset = true
# Enable rerere (reuse recorded conflict resolution), so that when git sees
# the same conflict in the future, it already knows how to fix it.
[rerere]
enabled = 1
# Useful URL aliases.
[url "[email protected]:"]
insteadOf = gh:
[url "git://gist.github.com/"]
insteadOf = gist:
[url "ssh://[email protected]/"]
insteadOf = rent:
[url "[email protected]:"]
insteadOf = r8y:
# Who? Me.
[user]
name = Ripta Pasay
email = [email protected]
[tag]
sort = v:refname
[filter "hawser"]
clean = git hawser clean %f
smudge = git hawser smudge %f
required = true
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /opt/homebrew-cask/Caskroom/sourcetree/2.0.5.2/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[log]
date = iso
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
process = git-lfs filter-process
[url "[email protected]:"]
insteadOf = https://git.ziprecruiter.com/