Skip to content

Instantly share code, notes, and snippets.

@rmcvey
Created June 16, 2016 16:31
Show Gist options
  • Save rmcvey/6da0ce4bf1a336934b4fdc6ee4e4f448 to your computer and use it in GitHub Desktop.
Save rmcvey/6da0ce4bf1a336934b4fdc6ee4e4f448 to your computer and use it in GitHub Desktop.
PS1 that displays git or svn status
scm_ps1() {
local s=
if [[ -d ".svn" ]] ; then
s=\(svn:$(svn info | sed -n -e '/^Revision: \([0-9]*\).*$/s//\1/p' )\)
else
s=$(__git_ps1 "(git:%s)")
fi
echo "$s"
}
export PS1="\[\033[00;32m\]\u\[\033[00;32m\]@\[\033[00;32m\]\h:\[\033[01;34m\]\w \[\033[31m\]\$(scm_ps1)\[\033[00m\]$\[\033[00m\] "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment