How to alias 'git checkout' to 'git co'

joseph.hainline picture joseph.hainline · Jan 23, 2013 · Viewed 40.4k times · Source

I'd like the command git co to be the same as typing git checkout.

A normal Bash alias (alias co='checkout') doesn't work.

Answer

joseph.hainline picture joseph.hainline · Jan 23, 2013

The command:

git config --global alias.co checkout

will create a git alias to do that. It will add the following entry into your global ~/.gitconfig file:

[alias]
    co = checkout