More aliases

In Chapter 2, Configuration, we saw how we can create aliases and a few examples of them. In this example, we will see some more examples of the useful aliases.

Getting ready

Clone the cookbook-tips-tricks repository and checkout the aliases branch:

$ git clone https://github.com/dvaske/cookbook-tips-tricks.git
$ cd cookbook-tips-tricks
$ git checkout aliases

How to do it...

Here, we'll see some examples of aliases with a short description of each of them and an example of how to use them. The aliases are just made for the local repository; use --global to make them available for all the repositories.

  • Show the current branch only:
    $ git config alias.b "rev-parse --abbrev-ref HEAD"
    $ git b
    aliases
    
  • Show a compact graph history view with ...

Get Git: Mastering Version Control now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.