Linux (Ubuntu): Show Current Git Branch in Terminal’s Prompt

Terminal does not have anything to do with git-branch. If you need to know in which branch you are currently working on then you need to manually type $ git branch.

Good News:

You can modify your terminal settings to make it show you which git branch you are working currently. To do this you need to put some piece of code in a file. Follow the steps below

  1. open the file ~/.bashrc (in home folder) with some text editor with root permission and copy-paste the following code in that file (click the link below to see the code snippet)
  2. Restart the terminal or open new tab, you are done!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s