Skip to content

Instantly share code, notes, and snippets.

@SamSamskies
Last active August 29, 2015 13:56
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 SamSamskies/8950150 to your computer and use it in GitHub Desktop.
Save SamSamskies/8950150 to your computer and use it in GitHub Desktop.
Bash git branch name with colors
BLACK="\[\033[0;30m\]"
RED="\[\033[0;31m\]"
GREEN="\[\033[0;32m\]"
YELLOW="\[\033[0;33m\]"
BLUE="\[\033[0;34m\]"
DEFAULT="\[\033[0;00m\]"
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
export PS1="$YELLOW<\u@\h∏> $RED\w$GREEN \$(parse_git_branch)$DEFAULT\$"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment