Including the git branch in the bash prompt
Put the following in ~/.bashrc to add the current git branch on the commandline prompt:
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PS1='\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\[\033[01;32m\]$(parse_git_branch)\[\033[00m\]\$ '
page revision: 0, last edited: 30 Nov 2010 21:07