[user]
	email = evan@ewpratten.com
	name = Evan Pratten

[core]
	excludesFile = ~/.gitignore

[init]
    defaultBranch = master

[pull]
    rebase = false

[advice]
    detachedHead = true

[alias]
	# Displays a ranked list of authors by number of commits
	authors = shortlog --summary --numbered --email

	# Displays a gitkraken-inspired commit tree
	tree = log --graph --decorate --abbrev-commit --all \
			--pretty=format:'%C(yellow)commit %h%C(auto)%d%n%C(cyan)Author:%Creset %aN %C(dim white)<%aE>%n%C(cyan)Date:%Creset %C(dim white)%ad (%ar)%n%s%n' \
			--date=format:'%b %d %Y %H:%M:%S %z'

    # A super quick overview of whats happening
    brief = log --pretty=format:'%C(yellow)%h %C(dim white)(%cr) %Creset%s'
    breif = brief
	
	# Lists all branches with their last commit
	branches = branch -a -l -vv

	# Displays a linear commit log
	overview = log --all --pretty=format:'%C(green)commit %C(yellow)%h%C(green) by %C(reset)%C(yellow)%aN %C(dim white)(%ar) %n%C(dim white)%S%n%B%n'

	# Ranks files by their activity
	lscommits = ! ( echo -e "Commits\tFile" && git log --pretty=format: --name-only | sed '/^$/d' | sort | uniq -c | sort -g -r ) | less

	# Recursively list the current state of all repos
	recursive-status = ! find . -type d -name .git -readable -prune -print0 2>/dev/null \
					   | xargs -0  -I{} sh -c \
						'echo $(dirname "{}" | cut -d '/' -f 2-) "%" $(git -C "{}" rev-parse --abbrev-ref HEAD) "%" $(git -C "{}" log -1 --format=%s)' \
					   | column -s "%" -t
	
	# Diff against another branch
    diff-against = diff --merge-base 

	# Un-fuck a branch that had a bit too much tinkering
    fix-recreated-branch = reset --hard @{u}

	# For working with dates
	author-date = log -1 --pretty="%aD" 
	set-all-commit-dates-to-author-dates = rebase --committer-date-is-author-date --root

	# For working with git notes
	pull-notes = fetch origin "refs/notes/*:refs/notes/*"
	push-notes = push origin "refs/notes/*:refs/notes/*"

	# Lazy macros
    fa = fetch --all
    pa = pull --all
    c = commit
    aa = add .
    s = status
    p = pull
    rebase-ch-i = rebase --reapply-cherry-picks -i

[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true

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

#[credential "https://github.com"]
#	helper = 
#	helper = !gh auth git-credential

[credential "https://gist.github.com"]
	helper = 
	helper = !gh auth git-credential

[credential "http://*.gurustudio.com"]
	helper = 
	helper = !/usr/bin/glab auth git-credential

[push]
	autoSetupRemote = true

# Allow machines to individually override settings
# NOTE: THIS MUST BE AT THE BOTTOM
[include]
	path = ~/.gitconfig.local