Bedazzle Your Bash Prompt with Git Info (for Ubuntu 9.04)
By kenglish
This is in response to the railstip.org post about how to Bedazzle Your Bash Prompt with Git Info. If you do this in Ubuntu, it will screw up your gnome-terminal title.
This is how add the git branch to your prompt in Ubuntu 9.04. Edit /home/kenglish/.bashrc. Find the lines with PS1. Replace them with this:
function parse_git_branch { ref=$(git symbolic-ref HEAD 2> /dev/null) || return echo "("${ref#refs/heads/}")" } if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] $(parse_git_branch) \$ ' #PS1="\w \$(parse_git_branch)\$ " else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w $(parse_git_branch)\$ ' fi



July 1st, 2009