Index syndication
comment syndication

Git branch name in your bash prompt

November 28, 2009 at 13:51 · Filed under git

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.

Evgeny said,

October 27, 2011 @ 19:01

Error in PS1 string.
Need be:
PS1=”\[33[01;32m\]\[email protected]\h\[33[00m\]:\[33[01;34m\]\w\[33[00m\]\$(parse_git_branch) “

RSS feed for comments on this post · TrackBack URI

Leave a Comment