Created
February 23, 2012 01:58
-
-
Save tovbinm/1889163 to your computer and use it in GitHub Desktop.
Git/SVN branch in bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parse_git_branch () { | |
git symbolic-ref HEAD 2> /dev/null | sed 's#refs/heads/\(.*\)# \1#' | |
} | |
parse_svn_branch() { | |
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | | |
awk '{print " (svn::"$1")" }' | |
} | |
parse_svn_url() { | |
svn info 2>/dev/null | sed -ne 's#^URL: ##p' | |
} | |
parse_svn_repository_root() { | |
svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p' | |
} | |
export PS1="\[\e[0;36m\]\u@\h\[\e[00m\]:\[\e[1;33m\]\w\$(parse_svn_branch)\$(parse_git_branch)\$ \[\e[0m\]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment