Created
August 27, 2012 15:28
his Gist alters the command-line prompt to indicate subversion and git branching. Place this in your .bashrc or .profile file.
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_svn_revision() { | |
svn info 2>/dev/null | sed -ne 's#^Last Changed Rev: ##p' | |
} | |
parse_svn_branch() { | |
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk -v rev=`echo $(parse_svn_revision)` '{print " [svn::"$1"-r"rev"]" }' | |
} | |
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' | |
} | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
WHITE="\[\033[1;37m\]" | |
RESET="\[\033[1;0m\]" | |
GIT='$(__git_ps1 "[%s]")' | |
SVN='$(parse_svn_branch)' | |
PS1="\n$WHITE\u@\h$RESET: \W$YELLOW$GIT$SVN $GREEN\$$RESET " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment