# vim: ft=gitconfig:noet:noml:
[user]
	useConfigOnly = true
[core]
	excludesFile = ~/.gitignore
	attributesFile = ~/.gitattributes
	pager = less -+$LESS -FRX
[commit]
	gpgSign = true
	verbose = true
[init]
	defaultBranch = main
	templateDir = /var/empty
[branch]
	sort = -committerdate
[color]
	# ui = auto
	branch = auto
	diff = auto
	status = auto
[diff]
	renames = copies
	tool = vimdiff
	colorMoved = default
	colorMovedWS = allow-indentation-change
	# default: myers
	# algorithm = patience
	# extends patience algo to "support low-occurrence common elements".
	# algorithm = histogram
[diff "xml"]
	textconv = xmllint --format --recover
[difftool]
	prompt = false
[difftool "difftastic"]
	cmd = difft \"$MERGED\" \"$LOCAL\" \"abcdef1\" \"100644\" \"$REMOTE\" \"abcdef2\" \"100644\"
[help]
	autoCorrect = prompt
[interactive]
	diffFilter = delta --color-only
[log]
	date = format-local:%Y-%m-%d %H:%M:%S
	decorate = auto
[merge]
	conflictStyle = diff3
	log = true
[pager]
	difftool = true
[pretty]
	author = format:%Cred%h%Creset %s %C(bold blue)%an%Creset
	changelog = format:- **%as:** %s  %n%-b
	cite = format:%h (\"%s\")
	date-oneline = format:%C(auto)%h | %as | %s
	dateline = format:%C(yellow)%h%Creset%x09%Cred%<(13)%an%Creset%x09%Cblue%ad%Creset%x09%s
	detail = format:%C(auto)%h %C(magenta)%ad %C(cyan)%an <%ae> / %C(magenta)%cd %C(cyan)%cn <%ce>%C(auto)%d %s
	fixes = format:Fixes: %h (\"%s\")
	history = format:%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset
	human = tformat:%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset
	lineauthor = format:%C(auto)%h %C(auto,cyan)%ad %C(auto,magenta)%<(14,trunc)%an%C(auto)%d %C(auto,reset)%s%C(auto,cyan) %(trailers:key=Acked-by,key=Reviewed-by,key=Tested-by,unfold,separator=%x2C )%C(auto,reset)
	log = format:%Cred%h %Creset%s%C(yellow)%d %Cgreen(%ar) %Cblue<%aN>
	mas = tformat:%C(bold)%h%Creset%C(yellow)%d %Creset%C(blue)%an <%ae> %Creset%C(dim italic)%ah%Creset%n%n  %w(,,2)%B%-C()%n
	md = format:%ad   %<(20)%ar %s
	min = format:%C(auto)%h%d %s %Cblue%aN <%aE>%Creset
	mine = format:%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d
	minimal = tformat:%C(bold blue)%h%C(auto)%d %C(reset 237)[%C(italic 65)%ar%C(reset 237)] %C(italic 240)by %an%C(reset)%n%s%n
	mon = format:%C(magenta)%h%Creset %C(blue)%ad%Creset %C(bold cyan)%an%Creset %s%C(yellow)%d%Creset
	multi = format:%C(bold blue)%h%C(reset) %C(bold cyan)%ad%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n          %C(white)%s%C(reset) - %C(dim white)%an%C(reset) %C(bold white)s:%G?%C(reset)
	one = format:%C(bold blue)%h%C(reset) %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) - %C(dim white)%an%C(reset) %C(bold white)s:%G?%C(reset)%C(auto)%d%C(reset)
	one-line = format:%C(yellow)%h %ad%Cred%d %Creset%s%Cblue [%cn]
	oneline = tformat:%C(red)%h%C(reset) - %s %C(green)(%cr) %C(blue)<%an>%C(reset)%C(auto)%d%C(reset)
	simple = format:%C(auto)%h %C(magenta)%ad %C(cyan)%an%C(auto)%d %s
	slog = format:* %s
	pretty = format:%C(red)%h%C(reset) %<(50,trunc)%s %C(green)(%cr)%C(reset) %C(blue)<%an>%C(reset) %C(auto)%d%C(reset)
	verbose = tformat:%C(bold blue)%h%C(auto)%d - %C(reset 237)[%C(italic 65)%aD%C(reset 237)] %C(italic 240)by %an%C(reset)%n%s%n%+b%-N%n
	table = tformat:%C(auto)%h%Creset %Cgreen(%as)%Creset %C(bold blue)<%an> %Creset%C(auto)%d%Creset %s
	tagdates = %ci %d
	time = format:%Cred%h%Creset %s %Cgreen(%cr)%Creset
	relauthor = "%C(auto)%h%d%C(reset) %s %C(bold blue)(%aL, %<(7,trunc)%ar\";\"%C(cyan)%cL, %<(7,trunc)%cr)%C(reset) %gs"
[pull]
	ff = only
[push]
	autoSetupRemote = true
	followTags = true
[rerere]
	enabled = true
[fetch]
	fsckObjects = true
[receive]
	fsckObjects = true
[transfer]
	fsckObjects = true
[tag]
	sort = version:refname
[web]
	browser = browser
[delta]
	hyperlinks = true
	light = true
	line-numbers = true
	navigate = true
	width = variable
	minus-style = 1
	minus-non-emph-style = 1 bold
	minus-emph-style = 1 reverse
	minus-empty-line-marker-style = normal normal
	plus-style = 2
	plus-non-emph-style = 2 bold
	plus-emph-style = 2 reverse
	plus-empty-line-marker-style = normal normal
	line-numbers-right-format = "{np:^4}│ "
	file-added-label = [+]
	file-copied-label = [=]
	file-modified-label = [~]
	file-removed-label = [-]
	file-renamed-label = [>]
	# file-style = 0 6
	file-decoration-style =
	hunk-header-decoration-style =
[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true
[sendemail]
	confirm = always
	suppressCc = self
	suppressCc = author
	annotate = true
[url "https://github.com:"]
	insteadOf = http://github.com/
	insteadOf = git://github.com/
[include]
	path = ~/.config/git/config.local
[includeIf "gitdir:~/projects/dotfiles/"]
	path = ~/.config/git/config.local
[alias]
	a = add
	aa = add --all
	ap = add --patch
	au = add --update
	forgive = blame
	c = commit --verbose
	# edit (replace) last commit (should not be used if already pushed!).
	ca = commit --amend
	# amend tip of the current branch, and edit the message.
	# change most recent commit message.
	# cam = commit --amend --message
	commend = commit --amend --message
	# amend all changes to the previous commit.
	# take currently staged files and `recommit` it under previous commit.
	again = commit --amend --reuse-message=HEAD
	# amend currently staged files to the latest commit.
	# use the last commit message and amend your stuffs.
	amend = commit --amend --reuse-message=HEAD
	# amend staging files, and do not edit the message.
	# add all modified files to the latest commit.
	# realize you forgot to add changes: git add x git append.
	# aka caane
	append = commit --all --amend --no-edit
	# amend tip of the current branch, and do not edit the message.
	forgot = commit --amend --no-edit
	cap = !git commit --amend --no-edit && git push --force-with-lease
	empty = commit --allow-empty --allow-empty-message --message ''
	b = branch -vv
	ba = branch -vv --all
	bn = rev-parse --abbrev-ref HEAD
	# branch names.
	bs = !git branch --no-color \"$@\" | sed -rn 's/(^(\\*| ) )([^[:space:]]+$)/\\3/p'
	lb = "!_() { git branch --verbose --sort=committerdate | tail -n 20; }; _"
	when = !git for-each-ref --sort=-committerdate --format='%(color:cyan)%(refname:lstrip=-2)%(color:reset) %(color:dim)(%(creatordate:short))%(color:reset) %(color:green)%(objectname:short)%(color:reset) %(contents:subject)'
	co = checkout
	cob = checkout -b
	co-main = !git checkout main && git pull origin
	co-develop = !git checkout develop && git pull origin
	# discard changes in a (list of) file(s) in working tree.
	discard = checkout --
	cl = clone
	cloner = clone --recursive
	clone-lean = clone --depth=1 --filter=combine:blob:none+tree:0 --no-checkout
	clone-shallow = clone --depth=1 --single-branch
	cfg = config list --show-origin
	cfgl = config list --show-origin --local
	cfgg = config list --show-origin --global
	d = diff
	d1 = diff HEAD~1 HEAD
	d2 = diff HEAD~2 HEAD
	d3 = diff HEAD~3 HEAD
	d21 = diff HEAD~2 HEAD~1
	da = diff HEAD
	das = diff HEAD --stat
	dc = diff --cached --find-copies-harder
	dd = diff -c HEAD --name-status
	df = diff --name-only
	df-staged = diff --staged --color
	di = diff --cached
	dn = diff -c HEAD --name-only
	ds = diff --staged
	dt = difftool
	dt-staged = difftool --staged
	dw = diff --word-diff
	added = diff --patience --cached --name-only
	changes = diff --name-status -r
	conflicts = diff --name-only --diff-filter=U
	diffstat = diff --stat -r
	mindiff = diff --ignore-all-space --word-diff-regex=. --color-words -U0
	mle = diff --color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+'
	precommit = diff --cached --diff-algorithm=minimal --ignore-all-space
	staged = diff --cached
	wd = diff --color-words
	word-diff = diff --word-diff
	w = !git word-diff
	dic = "!sh -c '[ \"$#\" = 1 ] && git diff $1^..$1 || git diff --cached ' -"
	diff-path = !git diff $2:$1 $1 && :
	diffr = "!f() { git diff \"$1\"^..\"$1\"; }; f"
	dl = "!f() { git diff \"$@\" | less -RS; }; f"
	dil = "!f() { git diff --cached \"$@\" | less -RS; }; f"
	dr = "!f() { git diff --ignore-all-space \"$1\"^..\"$1\"; }; f"
	dth = "!d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
	linestats = "!f() { git diff --numstat HEAD~$1 2>/dev/null | awk '{ added+=$1; removed+=$2 } END { print added+0, removed+0 }'; }; f"
	touched = diff HEAD^.. --name-only
	whitespace = !git --paginate diff-tree --check $(git hash-object -t tree /dev/null) HEAD
	gg = grep-group
	gn = grep --line-number
	# find text in any commit ever.
	grep-all = "!f() { git rev-list --all | xargs git grep \"$@\"; }; f"
	grep-group = grep --break --heading --line-number --color
	leg = log --date=short --pretty='%cd %h%d %aE: %s'
	lg = log --date=short --pretty='%cd %h%d %s'
	# lg = !sh -c 'git log "HEAD~$0..HEAD"'
	lm = log --pretty=format:'* %s (%h)'
	lop = log -p
	lo = log --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --no-merges
	ld = log --graph --patch --decorate --format='%C(yellow)%h%Creset %Cred%d%Creset %s %Cgreen%an%Creset (%C(cyan)%ar%Creset)'
	# l = log -18 --all --topo-order --pretty='format:%Cgreen%h%Creset %s%Cred%d%Creset %C(bold)(%an)%Creset' --color=always
	la = log --graph --all --abbrev-commit --decorate
	ll = log --all --topo-order --pretty='format:%Cgreen%h%Creset %s%Cred%d%Creset %C(bold)(%an)%Creset' --color=always
	# ll = log --graph --date=human --format='%C(auto)%h%C(auto)%d%C(reset) - %C(green)(%ad)%C(reset) %s %C(blue)[%an]%C(reset)' --first-parent
	lc = log --reverse --pretty=format:'- %s'
	# log history.
	gl = log -12 --graph --all --topo-order --pretty='format:%Cgreen%h%Creset %s %C(black bold)(by %an)%Creset%C(auto)%d%Creset%n' --color=always
	gll = log --graph --all --topo-order --pretty='format:%Cgreen%h%Creset %s %C(black bold)(%cr by %an)%Creset%C(auto)%d%Creset%n' --color=always
	# log w branches.
	lgb = log --graph --branches --abbrev-commit --pretty=format:'%h -%d %s (%cr) <%an>'
	# commit count per day.
	lgc = !git log --date=short --pretty=format:'%ad' | sort | uniq -c
	# log graph.
	lgg = log --graph --all --abbrev-commit --pretty=format:'%h -%d %s (%cr) <%ae>'
	# log w files. tracking development of file lines per day
	lgf = log --numstat --pretty=format:'%h%d %s [%cn]' --decorate
	# log history.
	lgh = log --graph --topo-order --date=short --pretty=format:'%C(auto)%h %C(reset)%<(52)%s %C(bold blue)%<(30)%ae %C(reset)%C(green)%cr (%cd) %C(auto)%d'
	# log w notes.
	lgn = log --graph --notes --oneline --abbrev-commit
	# log w stats.
	lgs = log --oneline --shortstat
	lgr	= log --pretty=format:'%C(auto)%h %ad | %s%d [%an]%C(reset)' --date=relative
	# log of tags.
	lgt = tag --sort=-version:refname -n1
	lpr = log --patch --reverse
	lh = log --graph --pretty=format:'%C(auto)%h %ad | %s%d [%an]%C(reset)' --date=short
	# list all new commits after you fetched, with stats, but excluding merges.
	loc = log ORIG_HEAD.. --stat --no-merges
	ol = !git log $1 --format='%C(auto)%h %<(16,trunc)%an %w(72,0,25)%s'
	ack = log --color=always --all --topo-order --pretty='format:%Cgreen%h%Creset %s%Cred%d%Creset %C(black bold)(by %an)%Creset' --full-history -S
	# show history of given file.
	history = log --patch --follow --find-renames=1 --
	authors = !git log --format='%aN <%cE>' | sort -u
	deleted = log --diff-filter=D --summary
	last = log -1 HEAD --stat
	logit = log --stat --find-renames
	lt = !git log --format='%h' -n 1
	churn = !git log --all --find-renames --find-copies --name-only --format='format:' \"$@\" | grep . | sort | uniq -c | sort
	cite = log -1 --pretty=cite
	count = !git log --pretty=oneline | wc -l | tr -d ' ' | sed 's/$/ commits/'
	# output only the commit message of a commit.
	message = "!_() { git log --format='%B' -1 \"${1:-@}\"; };_"
	# see: https://git.wiki.kernel.org/index.php/Aliases#What.27s_new.3F
	new = !sh -c 'git log $1@{1}..$1@{0} \"$@\"'
	news = log -p @{1}..
	tagdates = log --tags --simplify-by-decoration --pretty=tagdates
	unpushed = !git diff --name-only && git log --pretty=table --branches --not --remotes
	graph = log --graph -10 --branches --remotes --tags --
	graphgpg = log --graph --color --pretty=format:'%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%C(blue)%x20(%ce)%x20%C(cyan)[gpg:%GK%x20%G?]%C(reset)%n%x20%s%n'
	lf = !git log --graph --pretty=mon --date=short
	lq = !git log --graph --pretty=table
	flog = log --graph --date=short --pretty=format:'%h %ad | %s%d [%an]'
	plog = log @{1}..
	pslog = log --pretty=slog @{1}..
	rlog = !sh -c 'git log \"$@\" | fmt -s -w 79 | less -XFRS' _
	slog = log --pretty=slog
	tlog = log --graph --abbrev-commit --date=relative --pretty=oneline
	vlog = log --name-status
	# show changed files for given commit.
	lic = "!sh -c 'git log --numstat $1^..$1' - "
	pretty-one-line-log = log --graph --oneline --decorate
	# l = !git pretty-one-line-log || true
	l = !git --no-pager log --oneline -n 15
	tre = log --graph --all --oneline --decorate
	ls = ls-files
	lsio = ls-files --ignored --others --exclude-standard
	ignored = ls-files --ignored --others --exclude-standard
	modified = !git ls-files --modified
	exts = !git ls-files | grep -E '\\.[^./]+$' | sed 's|.*\\.|\\.|' | sort | uniq
	# git search for extension $1 and occurrence of string $2
	fe = "!f() { git ls-files \"*.$1\" | xargs grep -ni \"$2\" | less -R; }; f"
	urlremote = !git ls-remote --get-url $(git config get branch.$(git rev-parse --abbrev-ref HEAD).remote)
	tl = !git ls-tree --full-tree --name-only -r HEAD | tree -C --fromfile . | ${PAGER:-less}
	noff = merge --no-ff
	mo = merge origin/main
	pl = pull
	plb = !git pull origin $(git branch --show-current)
	plum = !git pull upstream $(git master-branch)
	plom = !git pull origin $(git master-branch)
	puff = pull --ff-only
	pr = pull --rebase
	pull-all = "!f() { git pull || :; git submodule foreach \"git pull || :\"; }; f"
	pull1 = !git pull origin \"$(git current-branch)\"
	ps = push
	pushf = push --force-with-lease
	push-branch = push --set-upstream origin HEAD
	put = push origin HEAD
	r = remote --verbose
	# undo `git add`.
	unadd = restore --staged --
	unstage = reset HEAD
	uncommit = reset --soft HEAD~1
	# undo your last commit, but don't throw away your changes.
	undo = reset --soft HEAD^
	rank = shortlog --summary --numbered --no-merges
	who = shortlog --summary --
	# show as much information about a commit(s) as possible.
	# for merge commits:
	#   add -m to see diff for the whole merge;
	#   omit -m to see diff for only conflict resolutions.
	sh = show --patch --stat --summary --pretty=fuller
	shls = diff-tree -r --no-commit-id --name-only
	s = show --ext-diff
	sf = show --pretty=format: --name-only
	sl = "!f() { git show --ext-diff \"$@\" | less -RS; }; f"
	sno = show --oneline --name-only
	sr = show --pretty=reference --no-patch
	common = !git show --oneline --no-patch $(git merge-base HEAD \"${1:-$(git main)}\") && :
	# describe, same as --pretty=reference
	ref = show --no-patch --date=short --pretty='format:%h (%s, %ad)'
	whatis = show --no-patch --pretty='tformat:%h (%s, %ad)' --date=short
	stl = stash list --name-status --pretty='format:%gd [%ar]: %s'
	st = status --short -uno
	stu = status --short -unormal
	stt = !git status --short | grep -v \"^??\"
	swm = !git switch $(git master-branch)
	# switch to last branch
	swl = "switch - "
	# treat file as though there are no changes to it even if there are.
	assume = update-index --assume-unchanged
	unassume = update-index --no-assume-unchanged
	assume-all = !git status --short | awk '{ print $2 }' | xargs -r git assume
	unassume-all = !git assumed | xargs -r git update-index --no-assume-unchanged
	assumed = !git ls-files -v | grep ^h | cut -c 3-
	whoami = !git var GIT_COMMITTER_IDENT | sed 's/>.*/>/'
	wt = worktree
	wta = worktree add
	wtl = worktree list
	wtr = "!git worktree list --porcelain | grep -B2 \"branch refs/heads/$1\" | head -n1 | sed -e 's|worktree ||' #"
	# find
	# find filename. gives absolute location (from the git root).
	find = !sh -c 'git ls-tree -r --name-only HEAD | grep --color $1' -
	ff = "!f() { file=$(git ls-files | grep \"$1\" | tail -n 1); git log -- \"$file\" | grep commit | cut -d\" \" -f2 | xargs -I{} git show {}:\"$file\"; }; f"
	# find branches containing commit.
	fb = "!f() { git branch --all --contains $1; }; f"
	# find tags containing commit.
	ft = "!f() { git describe --always --contains $1; }; f"
	# find commits by source code.
	fc = "!f() { git log --pretty=mine --decorate --date=short -S$1; }; f"
	# find commits by commit message.
	fm = "!f() { git log --pretty=mine --decorate --date=short --grep=$1; }; f"
	# show history of given file.
	# fh = "!f() { git log --oneline --follow $1; }; f"
	searchcommit = "!f() { query=\"$1\"; shift; git log -S\"$query\" \"$@\"; }; f"
	abbr = "!sh -c 'git rev-list --all | grep ^$1 | while read -r commit; do git --no-pager log -n1 --pretty=format:\"%H %ci %an %s%n\" $commit; done' - "
	dir = rev-parse --git-dir
	first = rev-list --max-parents=0 HEAD
	gr = "!git rev-parse --absolute-git-dir | sed -e 's|/[.]git.*||' #"
	root = rev-parse --show-toplevel
	hash = rev-parse HEAD
	head = rev-parse @
	info = !cat $(git rev-parse --git-dir)/config
	# output the hidden, initial SHA for a respository.
	initialsha = !printf '' | git hash-object --stdin -t tree
	me = !git config get user.name
	# me = !git config get --all --show-names --regexp user
	# find all objects that aren't referenced by any other object (orphans).
	orphans = fsck --full
	lost = fsck --lost-found
	parent = rev-parse --abbrev-ref --symbolic-full-name @{u}
	# ref = rev-parse --symbolic-full-name
	rev = rev-parse --short
	short = rev-parse --short
	sha = !sh -c 'git rev-parse ${1:-HEAD}' --
	source = remote get-url origin
	curbranch = symbolic-ref --short HEAD
	currentbranch = !git branch --contains HEAD | grep '*' | tr -s ' ' | cut -d\" \" -f2
	main = !git rev-parse --abbrev-ref HEAD | cut -d'/' -f2
	mainbranch = "!f() { git branch | grep -E '(master|main)$' | sed -Ee 's/.* //'; }; f"
	main-branch = !git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'
	master-branch = !git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
	# shorter way: rev-parse --abbrev-ref \"@{upstream}\"
	upstream = !git rev-parse --abbrev-ref --symbolic-full-name @{upstream} || git rev-parse --abbrev-ref --symbolic-full-name @{push} || echo origin/$(git curbranch)
	# repo version
	# ver = !git describe --long --tags --dirty 2>/dev/null | sed 's/-/.r/;s/-/./'
	ver = !git describe --long --abbrev=12 --tags --dirty 2>/dev/null
	# version number is derived from the date of the commit from which it was released:
	verno = !git -c \"core.abbrev=8\" show -s \"--format=%cd-%h\" \"--date=format:%Y%m%d-%H%M%S\"
	dm = !git diff $(git merge-base $(git main) HEAD)
	branches = branch --all
	remotes = remote --verbose
	stashes = stash list
	tags = tag -n1 --list
	lasttag = describe --abbrev=0
	alias = !git config list | sed -n 's/^alias\\.//p'
	aliases = "!f() { git --no-pager config get --all --show-names --regexp ^alias.$1; }; f"
	# aliases = !git config --get-regexp '^alias.' | awk -F '[. ]' '{ print $2 }'
	# aliases = !git config list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ \\t => \\2/' | sort
	# list git bins (lots of gems in there).
	bin = !find $(git --exec-path) -type f | xargs basename | $(git config get core.pager)
	which = "!_() { git config get --global alias.$1;};_"
	# output all the changes since the most recent tag as a Markdown list.
	# git changelog HEAD~5...
	changelog = "!f() { range=${1:-$(git lasttag)...HEAD}; git --no-pager log --reverse --no-merges --oneline --pretty=format:'- %s' $range; printf '\\n'; }; f"
	# markdown-friendly list of topic/branch related logs (great for pull requests).
	markdown = "!f() { bn=$(git name-rev --name-only HEAD); git log --no-merges --grep=$1 --pretty=oneline --abbrev-commit $bn | awk -F\"$bn: \" '{ print \"-\", $NF }' | uniq; }; f"
	madd = !git diff --name-only --diff-filter=U -z | xargs -0r grep -LZ '<<<<<<<' | xargs -0r git add -v
	medit = !git diff --name-only --diff-filter=U -z | xargs -0r grep -lZ '<<<<<<<' | xargs -0ro vim '+/<<<<<<<'
	mlist = !git diff --name-only --diff-filter=U
	my = !git log --branches=* --no-merges --pretty=format:'%d %s %h' --date=short --author=\"$(git me)\"
	# vim
	ed = !vim $(git ls-files --modified --others --exclude-standard) -p
	dv = "!f() { git diff --no-ext-diff \"$@\" | ${EDITOR} -R -c 'set ft=diff' -; }; f"
	div = "!f() { git diff --no-ext-diff --cached \"$@\" | ${EDITOR} -R -c 'set ft=diff' -; }; f"
	sv = "!f() { git show \"$@\" | ${EDITOR} -R -c 'set ft=diff' -; }; f"
	# external
	cloc = !cloc --vcs=git
	# see: https://tbaggery.com/2011/08/08/effortless-ctags-with-git.html
	ctags = !.git/hooks/ctags
	pg = pagediffs
	# delta/difft/diffnav/icdiff
	# diff-side-by-side = -c delta.features=side-by-side diff
	dfs = !GIT_PAGER=delta DELTA_FEATURES=+side-by-side git diff
	diff-side-by-side = !GIT_PAGER=delta git -c delta.features=side-by-side diff
	# dv = "!f() { git diff \"$@\" | diffnav; }; f"
	# diffn = !GIT_PAGER=diffnav git diff
	# see: https://difftastic.wilfred.me.uk/git.html#regular-usage
	ddiff = -c diff.external=difft diff
	dlog = -c diff.external=difft log --ext-diff
	dshow = -c diff.external=difft show --ext-diff
	recent = !GIT_EXTERNAL_DIFF=difft git log -p --ext-diff
	icdiff = --paginate difftool --tool icdiff
	diffy = difftool --no-prompt --trust-exit-code --extcmd 'icdiff -N -U3'
	# ripgrep
	rg = !rg $(git rev-parse --show-toplevel) --column --smart-case --regexp
	rga = !rg $(git rev-parse --show-toplevel) --column --smart-case --no-ignore --hidden --glob='!.git' --regexp
	# fzf
	filelog = !git log --oneline --since=1m \"$@\" | fzf --preview='git show --color $(echo {} | cut -d\" \" -f1)' --preview-window='default:right:60%' | cut -d\" \" -f1 | xargs -I{} git show {}
	hashes = !git log --graph --date=short --format=\"%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)\" --color=always
	pick = !git log -300 --oneline --color $1 | fzf --multi --ansi --preview='git show --color {1}' | awk '{ print $1 }'
	shows = !git log --oneline | git-fzf | cut -d\" \" -f1 | xargs --no-run-if-empty git show
	dff = "!f() { git diff --name-only $1 $2 | fzf --preview \"git diff --color $1 $2 -- {}\" | xargs -o -I{} git diff $1 $2 -- {}; }; f"
	dff-staged = "!f() { git diff --staged --name-only $1 $2 | fzf --preview \"git diff --staged --color $1 $2 -- {}\" | xargs -o -I{} git diff --staged $1 $2 -- {}; }; f"
	dtf = "!f() { git diff --name-only $1 $2 | fzf --preview \"git diff --color $1 $2 -- {}\" | xargs -o -I{} git difftool $1 $2 -- {}; }; f"
	dtf-staged = "!f() { git diff --staged --name-only $1 $2 | fzf --preview \"git diff --staged --color $1 $2 -- {}\" | xargs -o -I{} git difftool --staged $1 $2 -- {}; }; f"
	adf = !git diff --name-only | fzf --preview \"git diff --color -- {}\" | xargs -I{} git add -- {}
	logf = !git log --oneline | fzf --preview 'git show --color $(echo {} | cut -d\" \" -f1)' | cut -d\" \" -f1 | xargs -I{} git show {}
	# review -- fugitive
	# NOTE:
	# git diff --cached --merge-base A
	# is equivalent to
	# git diff --cached $(git merge-base A HEAD)
	review-base = !git merge-base \"${review_base:-origin/main}\" \"${1:-HEAD}\"
	base = review-base
	files = !git diff --name-only $(git review-base)
	stat = !git diff --stat $(git review-base)
	diff-review = !git diff $(git review-base)
	by-commit = !git log -p --reverse \"${1:-$(git review-base $2)}\"..\"${2:-HEAD}\"
	# review = !$EDITOR -p $(git files) +\"tabdo Gdiff ${review_base:-main}\"
	# reviewone = !$EDITOR -p +\"tabdo Gdiff ${review_base:-main}\"
	# reviewf = !$EDITOR -p $(git files | fzf) +\"tabdo Gdiff ${review_base:-main}\"
	git = !git
	tig = !~/.config/git/tig.pl
	begin = "!f() { git init && git commit --allow-empty --message='initial commit'; }; f"
	this = "!git rev-parse --show-prefix 2>/dev/null || { git init && git add . && git commit --message \"initial import of ${PWD##*/}\"; }"
	times = for-each-ref --sort=-committerdate --format='%(refname:short) (%(committerdate:relative))' refs/heads
	branch-activity = !sh -c 'git log -n1 --pretty=format:\"%aI%d\\n\" $1 --' -
	lr = log --color --graph --pretty=format:'%Cgreen%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
	lrs = log --graph --pretty=format:'%Cgreen%h%Creset - %s %C(yellow)%d' --abbrev-commit
	# see: https://git-scm.com/docs/BreakingChanges.html
	whatchanged = log --raw --no-merges
	# see: https://gameoftrees.org/comparison.html
	# backout = revert
	# histedit = rebase --interactive
	send = push
	patch = apply
	tree = ls-tree
	tog = tig
	stage = add -p
	# quickserve = daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/
