If you use Git
frequently, using aliases will save you several keystrokes every time, every day. Setting up a git alias takes a few minutes.
$ git config --global alias.<alias> <command>
Below are some of the aliases that we frequently use with git
.
git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.st status git config --global alias.a add git config --global alias.unstage "reset HEAD --" git config --global alias.last "log -1 HEAD"
We can run the above commands in the terminal below to see the effect. We have cloned a dummy repository in the terminal. We can use it to test the aliases.
Note: The alias commands can be run from anywhere on our system, provided we have
Git
installed. Plus, we don’t need to be in aGit
folder to use it.
RELATED TAGS
CONTRIBUTOR
View all Courses