Skip to content

Instantly share code, notes, and snippets.

@forficate
Created November 30, 2012 23:53
Show Gist options
  • Save forficate/4179611 to your computer and use it in GitHub Desktop.
Save forficate/4179611 to your computer and use it in GitHub Desktop.
Show current working SVN branch at bash prompt
# Add the below to ~/.bash_profile
function parse_svn_branch {
# Note for mac users, use sed -nE 's/URL:.*\/(trunk|branches\/[^\/]*|tags\/[^\/]*).*/\1/p'
svn info 2> /dev/null | sed -rne 's/URL:.*\/(trunk|branches\/[^\/]*|tags\/[^\/]*).*/\1/p'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
PS1="\u@\h \w$YELLOW \$(parse_svn_branch)$GREEN\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment