Skip to content

Instantly share code, notes, and snippets.

@rawfalafel
Created October 18, 2013 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rawfalafel/7042558 to your computer and use it in GitHub Desktop.
Save rawfalafel/7042558 to your computer and use it in GitHub Desktop.
bash prompt
export PS1="\[\e[35m\]\u@\h\[\e[0m\]:\[\e[35m\]\W"
export PS1=$PS1'$(__git_ps1 "\[\e[32m\]{%s}")\[\e[0m\]$ '
export _PS1=$PS1
__git_ps1 ()
{
local b="$(git symbolic-ref HEAD 2>/dev/null)"
if [ -n "$b" ]; then
if [ -n "$1" ]; then
printf "$1" "${b##refs/heads/}"
else
printf " (%s)" "${b##refs/heads/}"
fi
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment