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 checkoutgit config --global alias.br branchgit config --global alias.ci commitgit config --global alias.st statusgit config --global alias.a addgit 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.