Skip to content

Instantly share code, notes, and snippets.

@flashingpumpkin
Created January 15, 2010 11:28
Show Gist options
  • Save flashingpumpkin/277975 to your computer and use it in GitHub Desktop.
Save flashingpumpkin/277975 to your computer and use it in GitHub Desktop.
function _bash_git_status(){
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo " *"
}
function _bash_git(){
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ ~\1$(_bash_git_status)/'
}
function _virtual_env_name(){
[[ $(basename $VIRTUAL_ENV 2>/dev/null) ]] && echo "($(basename $VIRTUAL_ENV))"
}
function prompt(){
PS1="$(_virtual_env_name)\[\033[1;40;31m\]\u@\h\[\033[00m\]:\[\033[34m\][\W$(_bash_git)]\[\033[00m\]$ "
}
PROMPT_COMMAND=prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment