Skip to content

Instantly share code, notes, and snippets.

@philchristensen
Created February 16, 2011 15:29
Show Gist options
  • Save philchristensen/829560 to your computer and use it in GitHub Desktop.
Save philchristensen/829560 to your computer and use it in GitHub Desktop.
add current svn branch to shell prompt
function parse_svn_branch {
if [ -d '.svn' ]; then
ref=$(svn info | grep URL | awk -F/ '{print $NF}' 2> /dev/null) || return
cur=$(pwd | awk -F/ '{print $NF}' 2> /dev/null) || return
if [ $ref != $cur ]; then
echo "#$ref"
fi
fi
}
export PS1="\u@\h:\w\[\e[31;40m\]\$(parse_svn_branch)\[\e[0m\] \$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment