[Melbourne-pm] Git branches and PS1

Toby Corkindale toby.corkindale at strategicdata.com.au
Sun Feb 15 20:41:27 PST 2009

This is a neat feature to use with Git that I only just discovered:

Essentially, just add $(__git_ps1 " (%s)") to your PS1 in .bashrc, and 
now, if you're inside a directory containing a Git repository, then your 
prompt will include the current branch's name.

tobyc at arya:~$ cd git
tobyc at arya:~/git$ cd webval
tobyc at arya:~/git/webval (master)$ git checkout
git-svn          master           version-0.14
HEAD             user_to_userid
tobyc at arya:~/git/webval (master)$ git checkout user_to_userid
Switched to branch "user_to_userid"
tobyc at arya:~/git/webval (user_to_userid)$


More information about the Melbourne-pm mailing list