Skip to content

Instantly share code, notes, and snippets.

@joecannatti
Created July 10, 2011 01:51
Show Gist options
  • Save joecannatti/1074150 to your computer and use it in GitHub Desktop.
Save joecannatti/1074150 to your computer and use it in GitHub Desktop.
prompt
RED="\[\033[1;31m\]"
YELLOW="\[\033[1;33m\]"
GREEN="\[\033[1;32m\]"
NOCOLOR="\[\033[1;0m\]"
function parse_git_branch {
ref="$(git branch 2> /dev/null | sed -n "/*/ p" | awk '{ print $2 }')"
if [ -n "$ref" ]; then
echo "("${ref#refs/heads/}")"
fi
}
PS1="$YELLOW[\@] $RED\w $GREEN\$(parse_git_branch)$RED$ $NOCOLOR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment