[include]
	path = ~/.gitconfig-user

[core]
	; Git sets `$LESS` to `FRX` if it's not already set. `X` disables
	; sending termcap initialization and deinitialization strings to the
	; terminal, which leaves (potentially log) text on the screen and
	; disables mouse scrolling.
	pager = less -+X
	hooksPath      = ~/.githooks
	excludesFile   = ~/.gitignore
	attributesFile = ~/.gitattributes

[init]
	templateDir = ~/.gittemplate
	defaultBranch = master
	; defaultBranch = main

[remote]
	pushDefault = origin

[push]
	default = current
	recurseSubmodules = check

[branch]
	autoSetupMerge  = always
	autoSetupRebase = always

[fetch]
	prune     = true
	pruneTags = true

[rebase]
	autoSquash = true
	autoStash  = true
	updateRefs = true
	missingCommitsCheck = error

[pull]
	rebase = merges

[merge]
	ff = false
	autoStash = true
	conflictStyle = diff3

[am]
	threeWay = true

[rerere]
	enabled = true

[diff]
	renames   = copies
	algorithm = histogram

[url "ssh://git@"]
	pushInsteadOf = https://

[protocol]
	allow = never

[protocol "file"]
	allow = always

[protocol "ssh"]
	allow = always

[protocol "https"]
	allow = always

[transfer]
	fsckObjects = true

[fsck]
	zeroPaddedFilemode = warn
	badTimezone        = warn

[receive "fsck"]
	zeroPaddedFilemode = warn
	badTimezone        = warn

[fetch "fsck"]
	zeroPaddedFilemode = warn
	badTimezone        = warn

[notes]
	rewriteRef = refs/notes/commits

[format]
	notes = true

[status]
	showStash = true
	submoduleSummary = true

[log]
	abbrevCommit = true
	decorate = short

[log]
	date = relative

[blame]
	date = relative

[log]
	graphColors = \
	  BrightRed, \
	  BrightGreen, \
	  BrightYellow, \
	  BrightBlue, \
	  BrightMagenta, \
	  BrightCyan

[diff]
	colorMoved   = zebra
	colorMovedWS = ignore-space-change

[color "diff"]
	meta                      = BrightBlue
	frag                      =       Blue
	func                      =       Blue
	commit                    = BrightYellow
	whitespace                = BrightRed
	plain                     =       Yellow
	context                   = BrightWhite
	contextBold               = BrightWhite
	contextDimmed             =       White
	old                       = BrightRed
	oldBold                   = BrightRed
	oldDimmed                 =       Red
	new                       = BrightGreen
	newBold                   = BrightGreen
	newDimmed                 =       Green
	oldMoved                  = BrightMagenta
	oldMovedDimmed            =       Magenta
	oldMovedAlternative       =       Magenta
	oldMovedAlternativeDimmed =       Magenta
	newMoved                  = BrightCyan
	newMovedDimmed            =       Cyan
	newMovedAlternative       =       Cyan
	newMovedAlternativeDimmed =       Cyan

[blame]
	coloring = repeatedLines
	; coloring = highlightRecent

[color "blame"]
	repeatedLines = White
	highlightRecent = \
	  245, 1  years ago, \
	  246, 6 months ago, \
	  247, 5 months ago, \
	  248, 4 months ago, \
	  249, 3 months ago, \
	  250, 2 months ago, \
	  251, 4  weeks ago, \
	  252, 3  weeks ago, \
	  253, 2  weeks ago, \
	  254, 1  weeks ago, \
	  255

[absorb]
	; https://github.com/tummychow/git-absorb
	maxStack = 100

[pretty]
	patch    =  format:%C(BrightYellow)commit %h%C(auto)%d%n%C(BrightYellow)Author: %aN <%aE>%n%C(BrightYellow)Date:   %ad%n%n%C(Yellow)%s%n
	compact  = tformat:%C(BrightYellow)%h%x20%C(BrightMagenta)%>(13,trunc)%ar%x20%C(BrightBlue)%<(15,trunc)%aN%x20%C(BrightWhite)%s%C(auto)%d
	compactt = tformat:%C(BrightYellow)%h%x09%C(BrightMagenta)%>(1       )%ar%x09%C(BrightBlue)%<(1       )%aN%x09%C(BrightWhite)%s%C(auto)%d

[alias]
	; Log.
	l = "!f() { : git log ; \
	  git config --get-colorbool color.diff && color_diff=always; \
	  git -c color.diff=$color_diff log --graph --pretty=compactt \"$@\" \
	  | sed -E 's/^([^\\t]+\\t[^\\t,]+)(,.+)? ago(.*\\t.*)$/\\1\\3/' \
	  | sed -E 's/^(.*) +(.*[0-9a-f]{7}.*\\t)/\\1\\t\\2/' \
	  | sed -E 's/ *$//' \
	  | column -t -o ' ' -s \"$(printf '\\t')\" \
	  | eval \"LESS=${LESS-FRX} $(git var GIT_PAGER)\"; \
	}; f"
	ls = log --oneline --decorate=no
	lf = log --first-parent
	lp = log --patch --pretty=patch
	lpw  = lp --color-words='[_[:alnum:]]+|[^[:space:]]'
	lpww = lp --color-words='.'
	la    = l    --all
	lsa   = ls   --all
	lfa   = lf   --all
	lpa   = lp   --all
	lpwa  = lpw  --all
	lpwwa = lpww --all

	; Status.
	s  = status
	ss = status --short
	sb = status --short --branch
	sa  = s  --ignored
	ssa = ss --ignored
	sba = sb --ignored

	; Diff.
	d  = diff
	du = diff @{upstream}
	dp = diff @{push}
	dc  = d  --cached
	duc = du --cached
	dpc = dp --cached
	dw   = d   --color-words='[_[:alnum:]]+|[^[:space:]]'
	duw  = du  --color-words='[_[:alnum:]]+|[^[:space:]]'
	dpw  = dp  --color-words='[_[:alnum:]]+|[^[:space:]]'
	dcw  = dc  --color-words='[_[:alnum:]]+|[^[:space:]]'
	ducw = duc --color-words='[_[:alnum:]]+|[^[:space:]]'
	dpcw = dpc --color-words='[_[:alnum:]]+|[^[:space:]]'
	dww   = d   --color-words='.'
	duww  = du  --color-words='.'
	dpww  = dp  --color-words='.'
	dcww  = dc  --color-words='.'
	ducww = duc --color-words='.'
	dpcww = dpc --color-words='.'

	; Add.
	au = add -u
	aa = add -A

	; Commit.
	c  = commit
	ca = commit --amend

	; Rebase.
	ri = rebase -i
	ro = rebase -i --root
	rr = rebase --continue

	; Fetch.
	f = fetch

	; Push.
	p  = push
	pf = push --force-with-lease

	; Clean ignored files (requires either `-f`, `-i` or `-n`).
	x = clean -Xd

	; Contains.
	contains = tag --contains
	; contains = describe --contains