summary refs log tree commit diff
path: root/.config/git
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2025-04-30 13:31:51 +0200
committerRobert Günzler <r@gnzler.io>2025-04-30 13:31:51 +0200
commit5bd0a4aca65ecb9818ef1285982d160b6b6ff665 (patch)
tree46b5f3ba595b71eed3164aafbe44ab500b3872f3 /.config/git
parent3b82637b7cb29a033fefde7c5dc1b30b64756487 (diff)
git: update
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to '.config/git')
-rw-r--r--.config/git/config126
-rw-r--r--.config/git/ignore11
2 files changed, 87 insertions, 50 deletions
diff --git a/.config/git/config b/.config/git/config
index eb6a07a..141d409 100644
--- a/.config/git/config
+++ b/.config/git/config
@@ -1,32 +1,32 @@
 [user]
     name = Robert Günzler
     email = r@gnzler.io
-    signingkey = AF6AB8C8B10436B9F61293632143BD2AAB94BCC4
+    ; signingkey = AF6AB8C8B10436B9F61293632143BD2AAB94BCC4
+    signingkey = ~/.ssh/id_ed25519.pub
+
+[gpg]
+    format = ssh
 
 [sendemail]
     from = Robert Günzler <r@gnzler.io>
-    smtpServer = mail.gandi.net
-    smtpServerPort = 465
-    smtpEncryption = ssl
-    smtpUser = robert@gnzler.io
-    ; smtpServer = /usr/bin/msmtp
-    ; smtpServerOption=-a
-    ; smtpServerOption=gnzler
+    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"'
+    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"'
+    helper = !sh -c 'rbw get f94a873d-9d72-412e-a46d-53e4cd19a291 | xargs printf password=%s\\n'
 
-[credential "smtp://mailfence.com:465"]
+[credential "smtp.mailfence.com"]
     username = robert@gnzler.de
-    helper = !sh -c 'rbw get 68b0ea26-733a-43cd-b8f8-e8ecc98de072 | xargs printf "password=%s\n"'
+    helper = !sh -c 'rbw get 68b0ea26-733a-43cd-b8f8-e8ecc98de072 | xargs printf password=%s\\n'
 
 [core]
     excludesfile = $HOME/.config/git/ignore
@@ -51,6 +51,8 @@
 	autocrlf = false
 	longpaths = true
 
+    askPass = "~/bin/askpass"
+
 [init]
     defaultBranchName = master
     # templateDir = ~/.dotfiles/git/templates
@@ -58,13 +60,20 @@
 [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
-    signoff = true
+    gpgSign = true
     verbose = true
 
 [alias]
@@ -72,24 +81,28 @@
     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
-    cr = clone --recursive
     d = diff
     df = diff --word-diff
     ds = diff --staged
-    dss = diff --staged --stat
     dl = diff --stat
-    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"
+    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 --abbrev-commit
-    lm = log --pretty=format:'* %s (%h)'
-    lg = log -p
+    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 = commit --amend --reuse-message=HEAD --edit
+    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>
@@ -101,34 +114,35 @@
     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"
+    ; 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"
-    r = rebase
-    ri = rebase --autostash --autosquash -i
-    ri-pr = !bash -c 'git rebase --autosquash -i `git merge-base HEAD ${1:-origin/master}`'
+    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:-}; 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"
-    a = add --patch
+    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 rebase --autostash --onto=${1:-origin/master} $(git merge-base ${1:-origin/master} ${2:-HEAD}); }; f"
+    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
+    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
+    ; 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]
@@ -155,20 +169,32 @@
     # 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
@@ -182,6 +208,7 @@
     log = true
     defaultToUpstream = true
     tool = vimdiff
+
 [mergetool "vimdiff"]
     path = /usr/bin/nvim
     conflictstyle = diff3
@@ -200,10 +227,16 @@
     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:"]
@@ -222,37 +255,30 @@
 ;     insteadOf = "https://git.sr.ht/"
 ;     pushInsteadOf = "git://git.sr.ht/"
 
-[url "git@gist.github.com:"]
-    insteadOf = "gist:"
-    pushInsteadOf = "git://gist.github.com/"
+; [url "git@gist.github.com:"]
+;     insteadOf = "gist:"
+;     pushInsteadOf = "git://gist.github.com/"
 
 [http]
     sslverify = true
     cookiefile = /home/robert/.gitcookies
 
-[trailer "signoff"]
-    key = "Signed-off-by"
-    ifmissing = add
-    ; command = bash -c 'echo \"$(git config user.name) <${$(git config user.signemail):-$(git config user.email)}>\"'
-    command = echo \"`git config user.name` <`git config user.signemail || git config user.email`>\"
-    where = end
 [trailer "changetype"]
     key = "Change-type"
-    ifmissing = add
-    ifexists = doNothing
-    where = start
 [trailer "connects"]
     key = "Connects-to"
-    ifmissing = add
-    where = start
 [trailer "depends"]
     key = "Depends-on"
-    ifmissing = add
-    where = start
 [trailer "changelog"]
     key = "Changelog-entry"
-    ifmissing = add
-    where = start
+[trailer "coauthor"]
+    key = "Co-authored-by"
+[trailer "reviewed"]
+    key = "Reviewed-by"
+[trailer "tested"]
+    key = "Tested-by"
+[trailer "fixes"]
+    key = "Fixes"
 
 ; TIG config
 [tig]
diff --git a/.config/git/ignore b/.config/git/ignore
index 9a4c0d2..33b0186 100644
--- a/.config/git/ignore
+++ b/.config/git/ignore
@@ -47,3 +47,14 @@ bower_components
 # personal stuff
 .todo.md
 .org.md
+
+# clangd
+.cache/
+
+# cargo
+target/debug/build/
+target/release/build/
+
+# zig
+zig-out/
+.zig-cache/