Git branch name in your bash prompt

Here is a quick way to show the current git branch when you are in a repository directory. Place this in your .bashrc or .bash_profile:

I’ve also customised the PS1 to show user/host/path.

You should probably setup git bash completion as well. This can be done by sourcing the bash completion script that is available in the git source code as shown (change path to where you place script):

Have fun.

No Comments

Post a Comment

Your email is never shared. Required fields are marked *