[alias]
	diff = diff --word-diff

# Human Aliases
	unstage = reset -q HEAD --
	discard = checkout --
	uncommit = reset --mixed HEAD~

# Stash unstaged and untracked changes
	stashwip = stash save -u -k "WIP"

# Amend current commit w/ timestamp touch and author reset
	ca = commit --amend --reset-author

# Fixup staged changes to specified commit
	fixup = !sh -c 'REV=$(git rev-parse $1) && git commit --fixup $@ && git rebase -i --autosquash $REV^' -

# Commit staged changes into specific commit w/o opening editor
	fixit = "!f() { git commit --fixup=$1; GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash $1~1; }; f"

# remove changes
	scraplastcommit = reset --hard HEAD^

# keep your changes
	unwindlastcommit = reset --soft HEAD^

# generate a changeset to reverse a previous commit.
	reverselastcommit = revert HEAD
	nevermind = !git reset --hard HEAD && git clean -d -f

	# graph = log --graph -10 --branches --remotes --tags  --format=format:'%Cgreen%h %Creset• %<(75,trunc)%s (%cN, %cr) %Cred%d' --date-order
	# precommit = diff --cached --diff-algorithm=minimal -w

# List commits in short form, with colors and branch/tag annotations.
	ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]%Creset" --decorate

# List commits short form, tree
	lst = log --graph --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]%Creset" --abbrev-commit

# List commits showing changed files
	ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]%Creset" --decorate --numstat

# List with no colors if you need to chain the out put with Unix pipes:
	lnc = log --pretty=format:"%h\\ %s\\ [%cn]"

# oneline commits showing dates
	lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]%Creset" --decorate --date=short

# default look for short git log:
	le = log --oneline --decorate

# see all the commits related to a file, with the diff of the changes
	filelog = log -u
	fl = log -u

# check what was in the last commit
	dl = "!git ll -1"

# Show a diff last commit:
	dlc = diff --cached HEAD^

# Diff uncommited changes
	diffunc = diff --cached

# Show content (full diff) of a commit given a revision:
	dr  = "!f() { git diff "$1"^.."$1"; }; f"
	lc  = "!f() { git ll "$1"^.."$1"; }; f"
	diffr  = "!f() { git diff "$1"^.."$1"; }; f"

# Find a file path in codebase
	f = "!git ls-files | grep -i"

# Search/grep your entire codebase for a string:
	grep = grep -Ii
	gr = grep -Ii

# Grep from root folder
	gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f"

# List all Aliases, and these comments  //  la = "!git config -l | grep alias | cut -c 7-"
	la = "!cat ~/.gitaliases | sed -n -e '/# Human Aliases/,$p' | grep '^\t\\|\\#'"

# show last tag
	lasttag = describe --tags --abbrev=0
	lt = describe --tags --abbrev=0

# show recent branches
	short-recent = "for-each-ref --count=25 --sort=committerdate refs/heads/ --format='%(refname:short)'"

# fuzzy add using fzf
	fza = "!git ls-files -m -o --exclude-standard | fzf --print0 -m --preview 'git diff {}' --preview-window=top:10:wrap | xargs -0 -t -o git add --all"

# fuzzy restore using fzf
	fzr = "!git ls-files -m --exclude-standard | fzf --print0 -m --preview 'git diff {}' --preview-window=top:10:wrap | xargs -0 -t -o git restore"

# fuzzy restore staged using fzf
	fzrs = "!git diff --name-only --staged | fzf --print0 -m --preview 'git diff {}' --preview-window=top:10:wrap | xargs -0 -t -o git restore --staged"

# fuzzy switch branch...  /fish/functions/fco.fish seems better
	fco = "!git short-recent | fzf --print0 | xargs -0 -t git checkout"

# fuzzy fix staged changes into existing commit
	ffix = !HASH=`git log --pretty=oneline | head -n 100 | fzf` && git fixit `echo ${HASH} | awk '{ print $1 }'`

# fuzzy rebase interactive choose existing commit to start from
	frebase = !HASH=`git log --pretty=oneline | head -n 100 | fzf` && git rebase -i `echo ${HASH} | awk '{ print $1 }'`^

# fuzzy edit untracked/modified files
	fed = !FILES=`git status -s | awk '{ print $2 }' | fzf -x -m` && code ${FILES}

# fuzzy edit files in conflict state
	fedconflicts = !FILES=`git status -s | grep '^[UMDA]\\{2\\} ' | awk '{ print $2 }' | fzf -x -m` && code ${FILES}

# fuzzy gitgrep working tree for pattern and choose file(s) to edit 
	fgrep = !sh -c 'FILES=`git grep -l -A 0 -B 0 $1 $2 | fzf -x -m` && code `echo ${FILES} | cut -d':' -f1 | xargs`' -

# fuzzy select past commit, and edit current state of file(s) changed in it
	fedlog = !HASH=`git log --pretty=oneline | head -n 50 | fzf` && HASHZ=`echo ${HASH} | awk '{ print $1 }'` && FILES=`git show --pretty='format:' --name-only $HASHZ | grep -v -e '^$' | fzf -x -m` && code ${FILES}

# fuzzy reset back to prior commit 
	freset = !HASH=`git log --pretty=oneline | head -n 50 | fzf` && git reset --soft `echo ${HASH} | awk '{ print $1 }'`^
