Speeding up your Git Workflow with Aliases

When working with Git CLI we usually type lots of verbose and boilerplate commands. However, Git has alias support that might be handy and save a lot of “typing” energy as well as increase your productivity.

Git history graph view alias output (see below examples)
Git history graph view alias output (see below examples)
Git history graph view alias output (see below examples)

Getting Started

What is Git Alias

Basically Git Alias gives the ability to save some command with different name/nickname.

How to add Git Alias

There are 2 ways of adding new Git Alias:

  1. Adding to the git config file: $ git config --global --edit
...
[alias]
co = commit

2. Using Git CLI: git config --global alias.co checkout

Note: This is just automated version of “Option 1” for adding single git alias.

How to use Git Alias

  • So using the above example, instead of typing git checkout , it’s now possible to use just git co
  • Any additional parameters basically passed to the underlying command. Example, if you want to create and switch to a branch, instead of git checkout -b my-branch , you can use git co -b my-branch

Conclusion

Besides using Git CLI and aliases I would also suggest learning/mastering other Git tooling tips and tricks too in order to maximise your productivity and minimise repetitive work. Like IDE’s builtin Git support, or separate Git UIs like Github for Desktop, Sourcetree etc.

Bonus Tip. List of useful aliases

Sr. Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store