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
|
[user]
name = Robert Günzler
email = r@gnzler.io
; signingkey = AF6AB8C8B10436B9F61293632143BD2AAB94BCC4
signingkey = ~/.ssh/id_ed25519.pub
[gpg]
format = ssh
[sendemail]
from = Robert Günzler <r@gnzler.io>
smtpServer = smtp.mailfence.com
smtpEncryptionn = ssl
smtpUser = robert@gnzler.de
annotate = true
multiEdit = true
confirm = always
[credential "git.sr.ht"]
username = robertgzr
helper = !sh -c 'rbw get c7e750ea-6713-4254-90e7-6e077b552ffa | xargs printf password=%s\\n'
[credential "github.com"]
username = robertgzr
helper = !sh -c 'rbw get f94a873d-9d72-412e-a46d-53e4cd19a291 | xargs printf password=%s\\n'
[credential "smtp.mailfence.com"]
username = robert@gnzler.de
helper = !sh -c 'rbw get 68b0ea26-733a-43cd-b8f8-e8ecc98de072 | xargs printf password=%s\\n'
[core]
excludesfile = $HOME/.config/git/ignore
# 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
# Prevent showing files whose names contain non-ASCII symbols as unversioned.
# http://michael-kuehnel.de/git/2014/11/21/git-mac-osx-and-german-umlaute.html
precomposeunicode = false
filemode = false
# enable coditional paging based on the amount of content
; pager = "less -F -X"
pager = "diff-highlight | less -FRX --tabs=4"
autocrlf = false
longpaths = true
askPass = "~/bin/askpass"
[init]
defaultBranchName = master
# templateDir = ~/.dotfiles/git/templates
[interactive]
diffFilter="diff-highlight | less -FRX --tabs=4"
[log]
date = iso-strict-local
; date = relative
[format]
signoff = true
coverLetter = false
[column]
ui = auto
[commit]
template = ~/.config/git/message
gpgSign = true
verbose = true
[alias]
stp = status --porcelain --branch
sti = status --porcelain --branch --ignored
st = status -sb
stl = ls-files -m -o --exclude-standard
a = add --patch
ci = commit
br = branch
co = checkout
sw = switch
cp = cherry-pick
d = diff
df = diff --word-diff
ds = diff --staged
dl = diff --stat
diffthis = "!f(){ rev=${1:-HEAD}; git log --color=always -1 ${rev}; echo; git --no-pager diff --color=always -p --patch-with-stat ${rev}^..${rev}; }; f"
dt = diffthis
; diffsummary = "!f() { local a=${1:-HEAD}; local b=${2:-master}; if [[ $a == '-' ]]; then a=HEAD; fi; printf ' %s is %s commits ahead and %s commits behind %s\n' `git rev-parse --short=7 $a` `git rev-list --count $b..$a` `git rev-list --count $a..$b` $b; printf ' last common commit (merge-base): %s\n' `git merge-base $a $b`; git diff --shortstat $a..$b; }; f"
dft = difftool
unstage = reset --hard HEAD
lp = log --graph --pretty=format:'%Cred%h%Creset%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
ll = log --pretty=oneline --graph --decorate --abbrev-commit
lol = ll
lla = ll --all
lola = lla
g = grep --break --heading --line-number
amend = ci --amend --reuse-message=HEAD --edit
show-ignored = "! git clean -ndX | perl -pe 's/Would remove/Ignored:/'"
# usage: change-date [rev] [date] [...additional filter-branch flags]
# rewrites the commit/author date of <rev> to be <date>
# if <rev> is empty HEAD is used
# if <date> is empty the current time is used
change-date = "!f() { now=\"$(date +'%a %b %d %H:%M:%S %Y %z')\"; head=\"$(git rev-parse HEAD)\"; git filter-branch $3 --env-filter 'if [[ $GIT_COMMIT = ${1-$head} ]]; then export GIT_AUTHOR_DATE=${2:-$now}; export GIT_COMMITTER_DATE=${2:-$now}; fi'; }; f"
# usage: ld <n>
# prints out the `git log` for the n last days
log-since = "!sh -c \"git log --since '${1:-1} days ago' --oneline --author $(git config user.email)\" -"
# usage: pr <num> [<remote>]
# creates local branch pr/<num> from origin or <remote> and checks it out
; pr = "!f() { git fetch -fu ${2:-origin} refs/pull/${1:?missing pr num}/head:pr/$1 && git checkout pr/$1; }; f"
total-lines = "! git ls-tree -r master --name-only | xargs -I {} git blame --line-porcelain {} | sed -n 's/^author //p' | sort | uniq -c | sort -rn"
fixup = "!f() { git commit --fixup=${1}; }; f"
fix = "!f() { git fixup ${1} && git ri ${1}^; }; f"
squash = "!f() { git commit --squash=${1}; }; f"
ri = rebase --autostash --autosquash -i # -x 'git hook run pre-commit'
ri-pr = !bash -c 'git ri `git merge-base HEAD ${1:-origin/master}`'
mt = mergetool
pushf = push --force-with-lease
root = "rev-parse --show-toplevel"
trailer = "!f() { trailer=${1:?TRAILER}; ref=${2:-HEAD}; mode='--amend'; [ $ref != 'HEAD' ] && mode='--fixup=$ref'; msg=$(git rev-parse --show-toplevel)/LAST_COMMIT_MSG; git log -1 --format=%B $ref > $msg; git interpret-trailers --in-place --trailer $trailer $msg; git commit --allow-empty --no-verify --only --edit --file $msg $mode; rm $msg; }; f"
; oldest-ancestor = !bash -c 'diff -u <(git rev-list --first-parent ${1:-master}) <(git rev-list --first-parent ${2:-HEAD}) | sed -ne \"s/^ //p\" | head -1'
; oldest-ancestor = !bash -c 'git merge-base ${1:-master} ${2:-HEAD}'
rebaseonto = "!f() { git ri --onto=${1:-origin/master} $(git merge-base ${1:-origin/master} ${2:-HEAD}); }; f"
ro = rebaseonto
find-by-subject = "!f() { set -ex; s=`git log -1 --format=%s ${1}`; git --no-pager log -1 --grep=\"^${s}$\" --no-merges ${2}; }; f"
tig = !tig
amend = commit --amend
fixnow = "!f() { git commit --fixup=${1} && git ri ${1}^; }; f"
b = !fzfez git-branches | head -n1 | xargs -r git switch
l = !fzfez git-log
t = !fzfez git-tags
pushall = "!f() { args=$@; git remote show -n | xargs -I{} sh -c \"set -x;git push {} $args\"; }; f"
pushfall = "!f() { args=$@; git remote show -n | xargs -I{} sh -c \"set -x;git pushf {} $args\"; }; f"
; git-hack shortcuts
; hack = hack hack
; sync = hack sync
owners = "!f() { ref=\"$(git branch --format='%(upstream:short)'|head -n1)\"; git diff --name-only $ref | xargs -I{} git shortlog -nse $ref {} | sort -k2 | uniq -f2 | sed 's/^[ ]*//' | sort -gr | cut -f2; }; f"
owners = "!f() { local path=$(git ls-files --full-name $1) ref=$(git branch --format='%(upstream:short)'|head -n1); git shortlog -nse $ref $path; }; f"
reviewers = "!f() { ref=\"$(git branch --format='%(upstream:short)'|head -n1)\"; git diff --name-only $ref | xargs -I{} git shortlog -nse --group=trailer:reviewed-by $ref {} | sort -k2 | uniq -f2 | sed 's/^[ ]*//' | sort -gr | cut -f2; }; f"
[apply]
# Detect whitespace errors when applying a patch
whitespace = fix
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold # line info
old = red # deletions
new = green # additions
[color "status"]
added = yellow
changed = green
untracked = cyan
[diff]
# Detect copies as well as renames
renames = copies
renameLimit = 3210
tool = difftastic
[diff "bin"]
# Use `hexdump` to diff binary files
textconv = hexdump -v -C
renames = copies
tool = vimdiff
[difftool]
prompt = false
[difftool "difftastic"]
cmd = difft "$LOCAL" "$REMOTE"
[pager]
difftool = true
[fetch]
prune = true
[submodule]
recurse = true
[pull]
rebase = true
autostash = true
[grep]
lineNumber = true
[help]
# Automatically correct and execute mistyped commands
autocorrect = 10
[merge]
# Include summaries of merged commits in newly created merge commit messages
log = true
defaultToUpstream = true
tool = vimdiff
[mergetool "vimdiff"]
path = /usr/bin/nvim
conflictstyle = diff3
prompt = false
[rebase]
; instructionFormat = "%aI %an <%ae> | %s"
[rerere]
enabled = false
[push]
# Use the Git 1.x.x default to avoid errors on machines with old Git
# installations. To use `simple` instead, add this to your `~/.extra` file:
# `git config --global push.default simple`. See http://git.io/mMah-w.
default = simple
# Make `git push` push relevant annotated tags when pushing branches out.
followTags = true
# Automatically setup a tracking branch
autoSetupRemote = true
[tag]
gpgsign = true
[safe]
directory = /var/tmp/portage/*
directory = /var/cache/distfiles/git3-src/*
# URL shorthands
; [url "git@github.com:"]
; insteadOf = "https://github.com/"
; pushInsteadOf = "git://github.com/"
; [url "git@bitbucket.org:"]
; insteadOf = "https://bitbucket.org/"
; pushInsteadOf = "git://bitbucket.org/"
; [url "git@gitlab.com:"]
; insteadOf = "https://gitlab.com/"
; pushInsteadOf = "git://gitlab.com/"
; [url "git@git.sr.ht:"]
; insteadOf = "https://git.sr.ht/"
; pushInsteadOf = "git://git.sr.ht/"
; [url "git@gist.github.com:"]
; insteadOf = "gist:"
; pushInsteadOf = "git://gist.github.com/"
[http]
sslverify = true
cookiefile = /home/robert/.gitcookies
[trailer "changetype"]
key = "Change-type"
[trailer "connects"]
key = "Connects-to"
[trailer "depends"]
key = "Depends-on"
[trailer "changelog"]
key = "Changelog-entry"
[trailer "coauthor"]
key = "Co-authored-by"
[trailer "reviewed"]
key = "Reviewed-by"
[trailer "tested"]
key = "Tested-by"
[trailer "fixes"]
key = "Fixes"
; TIG config
[tig]
main-view = id date author commit-title:graph=yes,refs=yes
blame-view = date:default author id:yes,color line-number:yes,interval=1 text
pager-view = line-number:yes,interval=1 text
stage-view = line-number:yes,interval=1 text
log-view = line-number:yes,interval=1 text
blob-view = line-number:yes,interval=1 text
diff-view = line-number:yes,interval=1 text:yes,commit-title-overflow=no
line-graphics = utf-8
tab-size = 4
ignore-space = at-eol
ignore-case = true
split-view-height = 80%
diff-options = -m --first-parent
mouse = true
editor-line-number = yes
refresh-mode = auto
diff-highlight = true
[tig "color"]
diff-header = default magenta
diff-chunk = black white
[tig "bind"]
generic = I !@wl-copy -n "%(commit)"
generic = G move-last-line
generic = V view-pager
; generic = <Ctrl-n> find-next
; generic = <Ctrl-p> find-prev
; generic = <Ctrl-l> scroll-right
; generic = <Ctrl-h> scroll-left
; generic = <Ctrl-g> refresh
generic = ~ :goto %(commit)^
main = g none
main = gg move-first-line
main = G move-last-line
main = <esc>g :toggle commit-title-graph
diff = g none
diff = gg move-first-line
diff = G move-last-line
diff = n :/^@@
diff = p :?^@@
stage = n :/^@@
stage = p :?^@@
pager = n :/^@@
pager = p :?^@@
log = n :/^commit
log = p :?^commit
|