More aliases
In Chapter 2, Configuration, we saw how we can create aliases and looked at a few examples of them. In this section, we will look at some more examples of useful aliases.
Getting ready
We will have to clone the cookbook-tips-tricks
repository and check out the aliases
branch:
$ git clone https://github.com/PacktPublishing/Git-Version-Control-Cookbook-Second-Edition_tips_and_tricks.git
$ cd Git-Version-Control-Cookbook-Second-Edition_tips_and_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.
- Let's begin with an alias to show the current branch only:
$ git config alias.b "rev-parse --abbrev-ref HEAD"
$ git b
aliases
- To show a compact graph history view with colors, the following alias will save you many keystrokes:
$ git config alias.graph "log --graph --pretty...