Skip to content

Instantly share code, notes, and snippets.

@joslynesser
Created October 29, 2010 23:38
Show Gist options
  • Save joslynesser/654669 to your computer and use it in GitHub Desktop.
Save joslynesser/654669 to your computer and use it in GitHub Desktop.
Always display git branch
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
BRIGHT_RED="\[\033[1;31m\]"
DULL_WHITE="\[\033[0;37m\]"
BRIGHT_WHITE="\[\033[1;37m\]"
PS1="${DULL_WHITE}\w${BRIGHT_RED} \$(parse_git_branch)${BRIGHT_WHITE}\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment