[core]
	# Use vim as commit-message editor
	editor = vim

	# Don't wrap lines on paged views such as diff or log
	page = less -S

	# Just use delta as diff-viewer by default, note install: apt install git-delta
	pager = delta
[diff]
	# Use histogram in favor of readability over size for diffs
	algorithm = histogram

	# indicate moved lines by using alternative colors for added and removed lines
	colorMoved = zebra
[pull]
	# prefer to rebase local branches on remote changes instead of merging
	rebase = true
[mergetool]
	# I don't need the backups of a merge
	keepBackup = false
[rebase]
	# stash changes before merging remote changes this is very handy in conjunction with "pull.rebase=true"
	autoStash = true
[merge]
	# stash changes before merging remote changes this is very handy in conjunction with "pull.rebase=true"
	autoStash = true

	# provide more information about the situation before the changes in case of conflicts
	conflictstyle = zdiff3

	# Just a good diff-tool, mostly
	tool = vimdiff

	# List all the applied commits in the message of the merge-commit
	summary = true
[delta]
	# use n and N to move between diff sections
	navigate = true

	# show line numbers in delta diff view
	line-numbers = true
[interactive]
	diffFilter = delta --color-only
[init]
	defaultBranch = main
[alias]
	# Show all configured alias
	alias = config --get-regexp ^alias\\.

	# Manipulate the last commit
	amend = commit --amend

	# Just add any additional change to the last commit and push it
	# !!! Never use this in a shared project !!!
	ash = "!git add .; git cane; git fush"

	# Show all authors and their commit count in descending order
	authors = "!git log --format='%aN <%aE>' | awk '{arr[$0]++} END{for (i in arr){printf \"%6s  %s\\n\", arr[i], i;}}' | sort -rn"

	# Checkout a new branch from the current HEAD and use it instantly, e.g. git bc my-new-local-branch
	bc = checkout -b

	# Reset ALL changed files, even new and deleted, similiar but much faster to `rm -rf * && git reset --hard HEAD`
	bust = "!git restore --staged .; git co -- .; git clean -fd"

	# Shortcut to change last commit without changing the commit-message
	cane = commit --amend --no-edit

	# Same like bc and just a help to prevent typos
	cb = checkout -b

	# Just a convenience alias for the first commit of a new project
	cf = commit --allow-empty -m 'Initial commit'

	# Shortcut for checkout, we are all lazy
	co = checkout

	# Show the changes which will be committed
	dc = diff --cached

	# Fetch all remote-changes, but don't merge local branches!
	fa = fetch --all

	# Mark a change as a fixup to a given commit, e.g. `git fix HEAD~2`, see git commit --help
	fix = commit -n --fixup

	# Mark a change as fixup and try to squash it immediately into the original commit
	fixit = "!bash -c 'TARGET_HASH=`git rev-parse "'"'"$1"'"'"`; git fix $TARGET_HASH && git ria $TARGET_HASH^' -e"

	# Fetch all remote-changes from origin, but don't merge local branches!
	fo = fetch origin

	# Perform a push with force but only if there are no remote changes which we don't know already!
	fush = push --force-with-lease

	# Use vimdiff to view current changes
	gt = difftool --tool=vimdiff -y

	# Just show a verbose log of the last 6 commits
	last = log -6 --color --reverse --format='%C(red)commit:     %H%n%C(green)Author:     %aN <%aE>%nAuthorDate: %ad%Creset%n%n%C(bold blue)%w(100,4,4)%s%Creset%n%n%b' HEAD

	# Show a graph of all changes within the repository
	lg = log --graph --all --date-order --format='%C(yellow)%h %C(bold red)%d %Creset%s %Cgreen(%ar) %C(bold blue)%aN <%aE>'

	# Like 'lg' but with a ISO 8601-like timestamp
	lgi = log --graph --all --date-order --format='%C(yellow)%h %C(bold red)%d %Creset%s %Cgreen(%ai) %C(bold blue)%aN <%aE>'

	# Show a graph of only the current branch down to the development branch
	lgb = log --graph --date-order --format='%C(yellow)%h %Creset%s %Cgreen(%ar) %C(bold blue)%aN <%aE>%C(bold red)%d'

	# Like 'lgb' but with a ISO 8601-like timestamp
	lgbi = log --graph --date-order --format='%C(yellow)%h %Creset%s %Cgreen(%ai) %C(bold blue)%aN <%aE>%C(bold red)%d'

	# Like 'lgb' but with the committer timestamp
	lgbc = log --graph --date-order --format='%C(yellow)%h %Creset%s %Cgreen(%ci) %C(bold blue)%aN <%aE>%C(bold red)%d'

	# Show a graph of all commits and their Tickets
	lgbt = log --graph --date-order --format='%C(yellow)%h%C(red)%d%Creset %s%n%C(bold blue)%aN <%aE> %Creset%Cgreen%ar %C(red)%(trailers:key=Ticket,separator=%x2C )%n'

	# Like 'lgi' but with the committer timestamp
	lgc = log --graph --all --date-order --format='%C(yellow)%h %C(bold red)%d %Creset%s %Cgreen(%ci) %C(bold blue)%aN <%aE>'

	# Show a graph of all commits and their Tickets
	lgt = log --graph --all --date-order --format='%C(yellow)%h%C(red)%d%Creset %s%n%C(bold blue)%aN <%aE> %Creset%Cgreen%ar %C(red)%(trailers:key=Ticket,separator=%x2C )%n'

	# Open interactive rebase-console to given commit, e.g. `git ri HEAD~3`
	ri = rebase -i

	# Apply fixup and squach commits, see git commit --help
	ria = rebase -i --autosquash

	# Just save all as it is and add a stupid commit message to it
	save = "!git add .; git commit -nm save"

	# Mark a change as a squach to a given commit similiar to `fix`
	squ = commit --squash

	# We are lazy and don't want to type status all the time
	st = status

	# Show the summary of the last commit
	sum = "!__sum() { git log --color -1 --format=\"%C(red)commit %H%n%C(green)Author:     %aN <%aE>%nAuthorDate: %ad%n%C(yellow)Commit:     %cN <%cE>%nCommitDate: %cd%Creset%n%n%C(bold blue)%s%Creset%n%n%b\" $1 | git interpret-trailers; }; __sum"

	# Dispose all old branches which are already deleted remote, except of main, master and develop!
	trash = "!git branch --merged | egrep -v \"(^\\*|main|master|develop)\" | xargs git branch -d; git remote prune origin"

	# Unstage added files
	unstage = reset HEAD
[include]
	path = local.config
