How to Alias Git Checkout to Git Co and other Commands

Ever since the original Rails Tutorial we've needed git checkout to be aliased as git co. We run that command so often the saved keystrokes probably save a significant amount of time each year.

Here's how we do it in 2020. Simply add an alias to ~/.gitconfig like so:

    co = checkout

In the process we also found a neat tutorial for all kinds of aliases that you could set up in ~/.bashrc or ~/.zshrc. We added:

alias gaa='git add .'
alias gcm='git commit --message'

... since those are our two most common commands. We didn't add any other aliases since we don't like adding complexity to rarely used tasks.

Also, as one last pro-tip here is a great post on zshrc / bashrc, etc. loading orders. This is useful if you've ever found your changes don't seem to work... and remember:

source ~/.zshrc