If you are usig git branch in your terminal and ended up with a long list branches and struggling to find the active branch ?

Here is a quick way to do that.

Hey git, Show just the current branch

To get this, you have to type the below command. But it's very difficult to remember this.

$ git rev-parse --abbrev-ref HEAD 

I will help you to create an alias for this.

Let's create a git alias to view the active branch

Run the below command in your terminal.

$ git config  --global alias.br "rev-parse --abbrev-ref HEAD"  

Please note that, here "br" will be your alias. You can change it to any keyword. Like alias.mybranch or alias.activebrach . But I prefer a short keyword.

Now if you run below command , you will be able to see your current active branch.

$ git br 

That's it.

Likewise you can create aliases for any other commands in git.