EDIT: (12-Mar-2010) slight update to the svn prompt code to give a better / more useful output…
I’ve seen things like this posted on the net before but never really had a chance to play with the idea. But as I’m now using git and svn a lot more these days (fingers crossed i’ll be totally free of cvs soon!) I thought it was about time I pulled my finger out.
So here’s the end goal, in a normal directory, we just get a normal bash promt, but in a directory controlled by git or svn, we also get an addition telling us the source control tool in use and the current branch:
So, fire up yer terminal and add the following to your
(whichever one you use):
BLACK=“[\033[0;38m]” RED=“[\033[0;31m]” RED_BOLD=“[\033[01;31m]” BLUE=“[\033[01;34m]” GREEN=“[\033[0;32m]”
export PS1=“$BLACK[ \u@$RED\h $GREEN\w$RED_BOLD\$(parse_git_branch)\$(parse_svn_branch)$BLACK ] ”
Simples. Now just open up a new terminal and move into a project directory using svn or git. :)