Ben Grande b025ea0fea
fix: escape newline characters in git aliases
When 'git config --get "alias.*"' is run, it expands especial characters
breaking the retrieval of aliases and assignment for shell aliases
starting the g for git.
2024-12-03 11:29:37 +01:00

181 lines
5.5 KiB
Plaintext

; Global Git Config
; vim: ft=gitconfig
; SPDX-FileCopyrightText: 2010 - 2017 Tim Pope <https://tpo.pe>
; SPDX-FileCopyrightText: 2016 The Qubes OS Project <https://www.qubes-os.org>
; SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
;
; SPDX-License-Identifier: GPL-2.0-only
[alias]
; https://git.wiki.kernel.org/index.php/Aliases
; https://github.com/schacon/gitscm/tree/master
; Abbreviations
co = checkout
br = branch
sw = switch
st = status
df = diff
dc = diff --cached
ds = diff --stat -r
in = init
inb = init --bare
ci = commit
cia = commit --amend
cian = commit --amend --no-edit
cir = "!sh -c 'file=\"$(git rev-parse --git-dir)/COMMIT_EDITMSG\"; \
if test -s \"$file\"; then git commit -eF \"$file\" \"$@\"; else git commit \"$@\"; fi'" -
lg = !sh -c 'git log --color \"$@\"|fmt -s -w 79|less -FRSX' _
lgg = log --graph --pretty='format:%C(yellow)%h%C(reset) %C(magenta)%G?%C(reset) -%C(red)%d%C(reset) %C(reset)%s %C(green)(%cs)%C(reset) %C(blue)%aN%C(reset)'
lfi = ls-files --exclude-standard -s -o -i
lfu = ls-files --exclude-standard -o
lfs = ls-files --exclude-standard -s -d -m
gu = rev-parse --abbrev-ref --symbolic-full-name @{upstream}
r = remote
rl = remote -v
ra = remote add
rh = remote set-head
rs = remote set-url
rg = remote get-url
ru = remote update
rp = remote prune
rnm = remote rename
rmv = remote remove
cf = !git config --file ~/.gitconfig.local
; Helpers
aliases = "!sh -c 'if test -n \"$1\"; then git config --get \"alias.$1\"; else git config --get-regexp \"alias.*\" | colrm 1 6 | sed \"s/[ ]/ = /\"; fi'" -
; Patch with subject prefix containing repository name and output
; directory has the child directories the repository and branch name.
fp = "!sh -c 'git rev-parse --show-toplevel 2>&1 >/dev/null || return; \
repo=\"$(basename $(git rev-parse --show-toplevel) | \
sed s/^qubes-//)\"; \
outdir=\"$(git config format.outputDirectory)\"; \
ref=\"$(git symbolic-ref --short HEAD)\"; \
git format-patch \
--output-directory \"${outdir%*/}/${repo}/${ref}\" \
--subject-prefix=\"PATCH ${repo}\" \"${@}\" \
--diff-algorithm=histogram \
'" -
unstage = reset HEAD --
undo = reset --soft HEAD^
who = shortlog -s --
; whois <author name/e-mail>
whois = log -i -1 --pretty='format:%an <%ae>' --author
; whatis <commit name>
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
; See what commits have been created by the last command, eg: git pull
new = !sh -c 'git log "$1@{1}..$1@{0}" "$@"'
; List commits with the same the abbreviated hash.
abbr = "!sh -c 'git rev-list --all | grep \"^$1\" | while read commit; do \
git --no-pager log -n1 --pretty=format:\"%H %ci %an %s%n\" $commit; done' -"
; Solve merge conflicts
edit-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; \
editor=\"$(git var GIT_EDITOR)\"; \
if test -z \"${editor}\"; then \
exit 1; \
else \
\"${editor}\" $(f); \
fi"
add-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; \
git add $(f)"
; List tips of branches that are not in the first arg.
; git tips origin/master ^origin/alternate | git oneline
oneline ="!_() { $(test $# -eq 0 && printf '%s' \"xargs -L1\") \
git log --no-walk --decorate --oneline \"$@\"; }; _"
tips = "!_() { t=$(git rev-list --no-merges --max-count=1 \"$@\"); \
if test -n \"$t\"; then printf '%s\\n' \"$t\"; _ \"$@\" ^$t; fi; }; _"
; Submodules.
sub-update = !sh -c 'git checkout \"$1\" && git submodule update --recursive'
; Signed tags and commits
stag = "!f() { \
commit_id=\"$(git rev-parse --verify \"$@\")\"; \
if test -z \"$commit_id\"; then exit 1; fi; \
tag_name=\"signed_tag_for_$(printf '%s' \"$commit_id\" | cut -c 1-8)\"; \
if git tag -s \"$tag_name\" -m \"Tag for commit $commit_id\" \"$commit_id\"; \
then printf '%s\\n' \"$tag_name\"; fi; \
}; f" -
ptag = !git push "$(git config branch.$(git branch --show-current).remote)" "$(git describe)"
vtag = !git verify-tag -v "$(git describe)"
vhci = !git verify-commit -v "$(git rev-parse HEAD)"
vhtag = !git verify-tag -v "$(git tag --points-at=HEAD)"
[blame]
coloring = repeatedLines
[branch]
autoSetupMerge = always
autoSetupRebase = never
[color]
ui = auto
diff = auto
status = auto
branch = auto
interactive = auto
grep = auto
[commit]
gpgSign = true
verbose = true
template = ~/.config/git/message
[core]
excludesFile = ~/.config/git/ignore
pager = git-pager
[delta]
navigate = true
light = false
[diff]
algorithm = histogram
colorMoved = default
[diff "image"]
textConv = identify
[format]
coverLetter = auto
coverFromDescription = auto
thread = shallow
signOff = true
signatureFile = ~/.signature
outputDirectory = /tmp/patch
[gpg]
program = gpg
minTrustLevel = fully
[grep]
extendedRegexp = true
lineNumber = true
[init]
defaultbranch = main
templatedir = ~/.config/git/template
[interactive]
diffFilter = git-pager
[mailinfo]
scissors = true
[merge]
verifySignatures = true
tool = vimdiff
conflictStyle = diff3
summary = true
[protocol "qrexec"]
allow = always
[pull]
; Rebase does not verify signatures. Opt does not prevent manual rebase.
rebase = false
[push]
autoSetupRemote = true
default = current
gpgSign = if-asked
[rebase]
autoSquash = true
[sendemail]
annotate = true
multiEdit = true
confirm = always
thread = true
chainReplyTo = true
xmailer = false
[tag]
forceSignAnnotated = true
gpgSign = true
[user]
hideTimezone = true
[includeIf "gitdir:~/**/qubes-*/**"]
path = ~/.config/git/config.d/qubes-devel
[include]
path = ~/.gitconfig.local