-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitconfig
341 lines (236 loc) · 9.81 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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
[user]
name = Dennis Ideler
initials = di
email = [email protected]
[core]
autocrlf = input
safecrlf = true
excludesfile = /home/dennis/.gitignore_global
[color]
ui = auto
[push]
default = simple
[fetch]
prune = true
[credential]
helper = cache --timeout=3600 ; Cache credentials for 1 hour when using HTTPS.
[help]
autocorrect = 33 ; Autocorrect typos in 3.3 seconds.
[filter "hawser"] ; Added by GitHub for Mac, which uses git-hawser.
clean = git hawser clean %f
smudge = git hawser smudge %f
required = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
[pager]
diff = diff-so-fancy | less --tabs=1,5 -RFX
show = diff-so-fancy | less --tabs=1,5 -RFX
[commit]
gpgsign = false
verbose = true
[submodule]
fetchJobs = 4
[diff]
compactionHeuristic = true
[interactive]
singlekey = true
[alias] ; Note: Git ignores aliases that hide existing git commands.
### Basics
br = branch
cm = commit
co = checkout
df = diff
st = status
cp = cherry-pick
### Git-Duet (requires https://github.com/git-duet/git-duet)
; Paired commit.
dci = duet-commit --verbose
ci = dci
dc = dci
; Paired rebase.
drb = rebase -i --exec 'git duet-commit --amend --reset-author'
; Duet Double
dd = log --committer=ideler --author=ideler
### Logging
; Shows history of an existing or deleted file given its path.
history = log --all -- "$1"
; Shows the commit message of HEAD.
last = log -1
; Shows the last n commits.
see = !sh -c 'git log -p -$1' -
; Shows new commits since last command (e.g. after a `git pull`).
new-commits = !sh -c 'git log $1@{1}..$1@{0} "$@"'
; Logs commits with author and committer metadata.
lg = log --format=full
; Hides merges (shows a linear graph).
linear-log = !git lg --no-merges
; Lists commits of a topic branch that differ from master.
topic-commits = !git lg master..
; Lists yours commits made since midnight.
today = !git log --since=midnight --author=\"$(git config user.name)\" --oneline
; Lists yours commits made yesterday.
yesterday = !git log --since=yesterday.midnight --until=midnight --author=\"$(git config user.name)\" --oneline
; Commit history of last workday; use for daily standup. Uses yesterworkday fish function.
standup = !fish -ic 'git log --since "(yesterworkday)" --author "(git config user.name)"'
; Search commits by their changes.
search-diff = !sh -c 'git log -S "$1"' -
; Search commit diffs on a specific file (accounts for renames).
search-file-diff = !sh -c 'git log -S "$1" --follow "$2"' -
; Search commit messages on a specific file (accounts for renames).
search-file-log = !sh -c 'git log --grep "$1" --follow "$2"' -
### Clone
; Recursively clones repo, initializing any submodules.
cloner = clone --recursive
; Clones the repo with a shallow history (only the last commit).
shallow-clone = clone --depth 1
### Pull / Fetch / Merge
; Reapplies new commits from origin so history stays linear during updates.
update = pull --rebase
; Non fast-forward merge; creates a merge commit.
merge-commit = merge --no-ff
; Fetches all remotes and updates master with origin/master by fast-forwarding
ff = !git fetch --all && git checkout master && git merge --ff-only origin/master && git checkout -
fff = !git fetch --all && git checkout main && git merge --ff-only origin/main && git checkout -
### Push
; "Undo" the last push by force pushing the previous commit. Caution: rewrites pushed history.
unpush = push -f origin HEAD~1:master
; Push tags to remote (e.g. GitHub).
push-tags = push --tags
; You only live once.
yolo = push origin HEAD --force --no-verify
; Pushes all branches and sets upstream.
go = git push --all --set-upstream origin
; Lists committed files to be pushed.
to-push = diff --stat origin/master HEAD
### Staging
; Adds all new and modified content to the staging area.
add-all = add --all
; Adds all modified content in the current directory to the staging area.
add-modified = add --update .
; Similar to `add-modified` but works on the whole tree, not just cwd.
add-all-modified = add --update :/
; Adds untracked files to the staging area.
add-new = !git add $(git ls-files -o --exclude-standard)
### Commits
; Amends a commit. Adds staged changes to the last commit and rewrites commit msg.
amend = commit --amend
; Recommits files that were uncommited.
recommit = commit --reedit-message ORIG_HEAD
; Shows commit count of current branch.
commit-count = rev-list --count HEAD
### Stash
; Shows changes of a specific stash (see stash stack with `stash list`).
; To peek the top of the stack: `git stash show -p` or `git show stash`
show-stash = !sh -c 'git stash show --patch stash@{"$1"}' -
; Shows files changed in the most recent stash.
show-stash-files = stash show --name-only
; Restores stashed modifications (potentially on top a different commit).
; Note: Discards state of the stash list, unlike `stash apply`.
unstash = stash pop
; Pops the stash.
pop = stash pop
; Reset unmerged conflicts after a git stash pop.
unpop = checkout --force
### Reset
; CAUTION: Discards all changes (staged and unstaged) since the last commit.
; Unlike `git checkout` which only undoes changes prior to staging.
undo = reset --hard
; Undo staging of all or given files.
; Usage: git unstage ; unstages all
; git unstage . ; unstages all
; git unstage <file> ; unstages file
unstage = reset
unadd = reset HEAD ; Alias for unstage.
; Undo last commit (keeps staged changes).
uncommit = reset --soft HEAD^
; Remove last commit.
rm-commit = reset --hard HEAD^
; Undo a commit amend (with the help of reflog).
unamend = reset --soft 'HEAD@{1}'
; Resets current branch to the state of the remote master.
overwrite = !sh -c 'git fetch --all && git reset --hard origin/master'
; Reverts a merge commit and all its related changes
revert-merge = !sh -c 'git revert --mainline 1 "$1"' -
### Branches
; Lists all remote branches, sorted by most recent commit date.
remote-branches = for-each-ref --sort=-committerdate --format=\"%(refname:short)\t%(color:green)%(committerdate:relative)\t%(color:reset)%(subject) (%(authorname))\" refs/remotes
; Lists up to 5 local branches sorted by recent commit activity.
recent = for-each-ref --count=5 --sort=-committerdate --format='%(refname:short)' refs/heads
; Lists local unmerged branches.
unmerged-branches = branch --no-merged
; Renames the given local branch.
; If the branch to rename is checked out, just pass the new name.
rename-branch = branch -m ; <oldname> <newname>
### Pull Requests
; Checkout a remote branch by its PR number.
; E.g. git co-pr 123; <review>; git merge pr/123 --ff-only
co-pr = !sh -c 'git fetch origin pull/$1/head:pr/$1 && git checkout pr/$1' -
### Deletion
; Removes the given file on the remote branch.
rm-remote-file = rm --cached ; <filename>
; Removes the given remote branch.
rm-remote-branch = !sh -c 'git push origin --delete refs/heads/"$1"' -
; Removes the given remote tag.
rm-remote-tag = !sh -c 'git push origin --delete refs/tags/"$1"' -
; Nukes a branch locally and on the origin remote.
delete-branch = !sh -c 'git branch -D "$1" && git push origin --delete "$1"' -
; Delete a local tag
delete-tag = tag --delete # tagname
; Delete a remote tag
delete-remote-tag = push --delete origin # tagname
; Cleans up unnecessary files and optimizes the local repository.
housekeeping = gc --aggressive
; Untracks the given file/directory (does not delete file).
untrack = rm --cached
; Deletes local tags that are not on the origin remote.
prune-local-tags = fetch --prune origin "+refs/tags/*:refs/tags/*"
### Diffs
; Shows diff of what the current branch will introduce to master.
topic-changes = diff master
; Shows all diffs (staged and unstaged).
diffs = diff HEAD
; Shows trailing whitespace and spaces before tabs in (un)staged changes.
diff-space = diff --check head
; Shows master diff for a given file
file-diff = diff master -- $1
; By-pass diff-so-fancy for a vanilla git diff
dif = --no-pager diff
### Misc.
; Lists all git aliases.
aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
; Reveals the source of an alias if it exists.
command = !sh -c 'git config alias."$1" || echo "git-$1 is not a command"' -
; SHA1 of the given file.
hash = hash-object ; <filename>
; Adds a note to the last commit.
note = notes add
; Use for creating a new fca release.
tag-fca = !sh -c 'git tag --annotate deploy_production_$(date +%Y%m%d%H%M%S)'
; Prunes tracking branches that no longer exist on the remote.
prune-origin = fetch --prune origin
; Is GitHub asking for your username and password on a push? Use SSH instead of HTTPS.
; E.g. use-ssh dideler/dotiles
use-ssh = !sh -c 'git remote set-url origin [email protected]:"$1".git' -
; Shows SHA1 of last commit on origin.
last-sha-origin = !git ls-remote origin --heads refs/heads/master | cut -f1
; Shows the message of the version but not the diff.
info = show --no-patch
; Shows directory tree in the state when version was made.
tree = !bash -c 'object=${1:-HEAD} && git show "$object":' -
; Ignores local changes to a versioned file.
ignore-versioned-file = update-index --assume-unchanged ; <filename>
; Tracks a versioned file that was previously ignored.
unignore-versioned-file = !git update-index --no-assume-unchanged
; Shows name and email address of all contributors.
contributors = !git log --format='%aN <%aE>' | sort -f | uniq
; TODO: bundling a repo for sharing it
; git bundle create <repo>.bundle --all
; git clone <repo>.bundle
[pull]
rebase = false
[protocol "keybase"]
allow = always
[init]
defaultBranch = main