How to alias 'git checkout' to 'git co'
48,891
Solution 1
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
Solution 2
Also, can edit this into your git config:
[alias]
co = checkout
Related videos on Youtube
Author by
joseph.hainline
Digital Client Director by day. iOS, Ruby, Python, C++, C#, Flutter developer by night.
Updated on December 13, 2020Comments
-
joseph.hainline over 3 years
I'd like the command
git co
to be the same as typinggit checkout
.A normal Bash alias (
alias co='checkout'
) doesn't work. -
John Szakmeister over 11 yearsYou don't need to do '!git'. You can just use 'co = checkout'. That prevents re-invoking git under another process... which can be advantageous on Windows where starting a new process is expensive.
-
fangzhzh almost 10 yearsfor people who don't know where is git config: vi ~/.gitconfig or git config --global -e
-
Chris over 2 yearsFind more details (and examples) in the manual here: git-scm.com/book/en/v2/Git-Basics-Git-Aliases