-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_gitconfig.tmpl
223 lines (177 loc) · 6.61 KB
/
dot_gitconfig.tmpl
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
# vim:ft=gitconfig
[user]
name = Kenny Pitt
email = {{ .email }}
[core]
excludesfile = ~/.gitignore
quotepath = false
{{- if eq .chezmoi.os "windows" }}
autocrlf = true
{{- else }}
autocrlf = input
{{- end }}
untrackedCache = true
[color]
ui = auto
[push]
default = upstream
[merge]
summary = true
[init]
defaultBranch = main
[mergetool "smerge"]
cmd = smerge mergetool \"$BASE\" \"$LOCAL\" \"$REMOTE\" -o \"$MERGED\"
trustExitCode = true
[alias]
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# Additional git log aliases
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
lc = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative --first-parent
# View the current working tree status using the short format
s = status -s
sb = status -sb
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
df = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat | diff-so-fancy"
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
# Commit all changes
ca = !git add -A && git commit -av
# Switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
# Shortcuts for stashes
stashes = stash list
sapply = stash apply
sdrop = stash drop
slist = stash list
spop = stash pop
# List aliases
aliases = "!git config -l | grep '^alias\\.' | cut -c 7-"
# Amend the currently staged files to the latest commit
amend = commit --amend --reuse-message=HEAD
# Shortcuts for various types of merges
ff = merge --ff-only
rb = rebase
rbi = rebase --interactive
rbu = rebase --update-refs
rbui = rebase --update-refs --interactive
## Shortcuts for accessing remote repositories
# Clone a repository including all submodules
c = clone --recursive
# Make a blobless clone (all commits and trees, but only checked out blobs)
cnb = clone --filter=blob:none
# Make a treeless clone (all commits, but only checked out trees and blobs)
cnt = clone --filter=tree:0
# Pull in remote changes for the current repository and all its submodules
p = pull --recurse-submodules
# Pull remote changes with fast-forward merge
pff = pull --ff-only --recurse-submodules
# Pull remote changes with rebase
prb = pull --rebase --recurse-submodules
# Fetch remote changes for the current repository and all its submodules
f = fetch --prune --recurse-submodules
# Basic convenience shortcuts
ci = commit
co = checkout
cob = checkout -b
## Shortcuts for working with submodules
sm = submodule
sma = submodule add
smd = submodule deinit
sms = submodule status --recursive
smi = submodule init
smu = submodule update --init --recursive
smeach = submodule foreach
smeachr = submodule foreach --recursive
## Shortcuts for working with worktrees
wt = worktree
wta = worktree add
wtl = worktree list
wtmv = worktree move
wtrm = worktree remove
## Shortcuts for update-index commands
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = !git ls-files -v | grep ^h | cut -c 3-
assumeall = !git status -s | grep -v ^\\?\\? | awk {'print $2'} | xargs git assume
unassumeall = !git assumed | xargs git update-index --no-assume-unchanged
lock = update-index --skip-worktree
unlock = update-index --no-skip-worktree
locked = !git ls-files -v | grep ^S | cut -c 3-
lockall = !git status -s | grep -v ^\\?\\? | awk {'print $2'} | xargs git lock
unlockall = !git locked | xargs git update-index --no-skip-worktree
## External merge tool shortcuts
p4diff = difftool -y --tool=p4merge
p4merge = mergetool -y --tool=p4merge
bcdiff = difftool -y --tool=bc3 --trust-exit-code
bcmerge = mergetool -y --tool=bc3
smmerge = mergetool -y --tool=bc3
## GitHub Flow aliases
## (see <https://haacked.com/archive/2014/07/28/github-flow-aliases/>)
save = !git add -A && git commit -m 'SAVEPOINT'
wip = commit -am 'WIP'
undo = reset HEAD~1 --mixed
wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard
default-branch = !git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
merged = "!f() { DEFAULT=$(git default-branch); git branch --merged ${1-$DEFAULT} | grep -v " ${1-$DEFAULT}$"; }; f"
bclean = "!f() { DEFAULT=$(git default-branch); git merged ${1-$DEFAULT} | xargs git branch -d; }; f"
## Shortcut names for additional Git tools in `~/.bin`
in = incoming
out = outgoing
[url "git@github.com:"]
insteadOf = gh:
[url "git@bitbucket.org:"]
insteadOf = bb:
[hub]
protocol = ssh
[filter "lfs"]
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
[pager]
diff = delta
log = delta
reflog = delta
show = delta
[interactive]
diffFilter = delta --color-only
[color "diff"]
meta = "yellow"
frag = "magenta bold"
commit = "yellow bold"
old = "red bold"
new = "green bold"
func = "bold blue"
whitespace = "red reverse"
[color "diff-highlight"]
oldNormal = "red bold"
oldHighlight = "bold #ceb0b6 #53343b"
newNormal = "green bold"
newHighlight = "bold #c0c5b9 #45493e"
[delta]
plus-style = "syntax #45493e"
plus-emph-style = "bold syntax #5E664F"
minus-style = "syntax #432A30"
minus-emph-style = "bold syntax #76424E"
line-numbers-plus-style = "#9DA865"
line-numbers-minus-style = "#D45252"
line-numbers-zero-style = "#444B71"
syntax-theme = Nord
navigate = true
line-numbers = true
[rerere]
enabled = true
# Optional extension files (last value wins, so order is important)
[include]
# work can override personal
path = ~/.gitconfig-work
# local can override anything
path = ~/.gitconfig-local
#########################################################################
##### Anything below this line was appended by an automated script! #####