If you’re using git, these handy short codes will speed up your workflow. The following are the basic abbreviated git commands that are recommended on the git website. I'm always forgetting how to do this when I need to set up git on new computer so posting this as a reference.
-
co
for checkout -
br
for branch -
ci
for commit -
st
for status
How to Set Up
To set up an alias, you use the git config command with the --global tag so that it applies to all of your git repositories.
$ git config --global alias.<YOUR CHOSEN SHORTCUT> <THE ORIGINAL GIT COMMAND>
So to set up the basic shortcuts I mentioned above, open your terminal and put in the following:
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
Now your all set to go! You can use co
in place of checkout
and so on. For example, for git commit
, you can now do something like this:
git ci -m "add CSS styles"
See the official git documentation here.
Top comments (4)
Interesting. Was thinking it's gonna be terminal aliases. Didn't know git aliases were a thing. Will attempt it today. Thank you
Yeah, they are really handy. I feel like it speeds up my workflow a lot. If you do a bit more research, you can find a lot more suggestions for convenient aliases that other developers use too!
nice! I <3 me some 2-letter commands ;-) thanks!
You are welcome! Thanks for reading!