[include]
    path = ~/.config/git/config-signing
[user]
	name = Edmund Miller
	email = git@edmundmiller.dev
[commit]
	verbose = true
[tag]
	sort = -version:refname
[core]
	whitespace = trailing-space
	excludesfile = ~/.config/git/ignore
	pager = delta
[init]
	defaultBranch = main
[github]
	user = edmundmiller
[gitlab]
	user = emiller88
[pull]
	rebase = true
[rebase]
	autosquash = true
[push]
	default = current
	autoSetupRemote = true
[column]
	ui = auto
[branch]
	sort = -committerdate
[rerere]
	enabled = true
	autoupdate = true
[alias]
	amend = commit --amend
	# difftastic on-demand (keeps diff.external unset so tools like difi/delta work)
	ddiff = -c diff.external=difft diff
	dl = -c diff.external=difft log -p --ext-diff
	ds = -c diff.external=difft show --ext-diff
	cdiff = "!f() { critique \"$@\"; }; f"
	creview = "!f() { critique review \"$@\"; }; f"
	hdiff = "!f() { git -c core.pager='hunk pager' diff \"$@\"; }; f"
	hshow = "!f() { git -c core.pager='hunk pager' show \"$@\"; }; f"
	difi = "!git diff --no-ext-diff --color=always \"${1:-HEAD}\" | TERM=xterm-256color difi #"
	exec = "!exec "
	lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
	ls = ls-files
	orphan = checkout --orphan
	unadd = reset HEAD
	undo-commit = reset --soft "HEAD^"
	# data analysis
	ranked-authors = !git authors | sort | uniq -c | sort -n
	emails = !git log --format="%aE" | sort -u
	email-domains = !git log --format="%aE" | awk -F'@' '{print $2}' | sort -u
[filter "lfs"]
	required = true
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	clean = git-lfs clean -- %f
[url "https://github.com/"]
    insteadOf = gh:
[url "git@github.com:edmundmiller/"]
    insteadOf = gh:/
[url "https://gitlab.com/"]
    insteadOf = gl:
[url "https://gist.github.com/"]
    insteadOf = gist:
[url "https://bitbucket.org/"]
    insteadOf = bb:
[delta]
	navigate = true
	side-by-side = true
	line-numbers = true

[interactive]
	diffFilter = delta --color-only

[diff]
	tool = difftastic
	algorithm = histogram
	colorMoved = plain
	mnemonicPrefix = true
[difftool]
	prompt = false
[difftool "difftastic"]
	cmd = difft "$LOCAL" "$REMOTE"
[difftool "critique"]
	cmd = critique difftool "$LOCAL" "$REMOTE"
[pager]
	difftool = true

# Conditional includes for work contexts
[includeIf "gitdir:~/src/seqera/**"]
    path = ~/.config/git/config-seqera
[includeIf "gitdir:~/src/nextflow/**"]
    path = ~/.config/git/config-seqera
[includeIf "gitdir:~/src/nf-core/**"]
    path = ~/.config/git/config-nfcore
