Skip to content

Instantly share code, notes, and snippets.

@r38y
Created February 19, 2009 04:01
Show Gist options
  • Save r38y/66720 to your computer and use it in GitHub Desktop.
Save r38y/66720 to your computer and use it in GitHub Desktop.
parse_git_dirty() {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
parse_git_branch() {
git branch 2> /dev/null | sed -e "/^[^*]/d" -e "s/* \(.*\)/(\1$(parse_git_dirty))/"
}
parse_svn_branch() {
svn info 2> /dev/null | grep URL | sed -e "s/.*\/\(.*\)$/(\1)/"
}
PS1="\n\
\[\033[0;33m\]\h \[\033[0;35m\]\$PWD \[\033[0;37m\]\$(parse_git_branch)\$(parse_svn_branch)
\[\033[0;32m\]\u$DIM \[\033[0;37m\]$ "; export PS1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment