O'Reilly logo

Git: Mastering Version Control by Jakub Narębski, Rasmus Voss, Aske Olsson, Ferdinando Santacroce

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring and using Git aliases

Git aliases, like Unix aliases, are short commands that can be configured on a global level or for each repository. It is a simple way of renaming some Git commands to short abbreviations, for example, git checkout could be git co and so on.

How to do it...

It is very simple and straightforward to create an alias. You simply need to configure it with git config.

What we will do is check a branch and then create its aliases one by one and execute them to view their output by performing the following steps:

  1. So, we will start by checking a branch named gitAlias that tracks the origin/stable-3.2 branch:
    $ git checkout -b gitAlias --track origin/stable-3.2
    Branch gitAlias set up to track remote branch stable-3.2 from ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required