If you are like me and use git bash, powershell cmd or some other command line utility for git you quickly learn there is a lot of keystrokes to do repetitive tasks. Creating aliases in git is a convenient way to minimize the amount of keystrokes you will have to make. Here are some alias I have setup that I use on a daily basis:

Alias Name Configuration Setup Example Usage Description
git b git config –global alias.b branch git b master Allows you to easily switch branches
git co git config –global alias.co checkout git co new_feature Checkout a new branch
git undo git config –global alias.undo “reset HEAD~1 –mixed” git undo Undo the last commit.

Each time you create an alias you are adding it to one of 3 config files: local, system and global. In the examples above I add it to the global config file. To learn more about these config files take a look here: git-config