git config --global alias.chunk 'add -p'Usage: starts an interactive chunk-by-chunk staging session, similar to git rebase -i. Handy for picking apart a full index to make a nicer narrative of small commits.
git config --global alias.current 'rev-parse --abbrev-ref HEAD'Usage: mostly for reliably interpolating your current branch name into other scripts.
git config --global alias.discard 'checkout --force --'Usage: discard changes in working directory.
git config --global alias.distance '!distance(){ git diff ${1:-master}...HEAD --shortstat; }; echo $(distance) since last common commit to ${1:-master}'Usage: shows you how far you've come since you last diverged from another branch/ref (master by default).
git config --global alias.golf 'git diff --shortstat'Usage: less code is better than more code.
git config --global alias.last '!last(){ git diff HEAD~1 HEAD && git log -n1; }; last'Usage: shows the changes and message of the last commit.
git config --global alias.latest 'log -n5'Usage: shows the messages of the last 5 commits.
git config --global alias.oops 'commit --amend --no-edit'Usage: apply changes in index to last commit. Use -a to use entire working tree (except for new files), specify files in particular, or use git add before running as normal.
git config --global alias.rollback '!rollback(){ cd ${GIT_PREFIX:-.} && git reset HEAD~${1:-1} --soft; }; rollback'Usage: unwinds the given number of commits (1 by default) into your index. Destroys commit messages but never any changes.
git config --global alias.unstage 'reset HEAD'Usage: removes changes from the index. Specify --hard to erase them entirely.
git discardandgit unstagein particular are verbatim those two commands you can never remember and have to rungit statusevery time to be reminded of.