Skip to content

Instantly share code, notes, and snippets.

@JoshuaEstes
Created September 16, 2011 16:04
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 JoshuaEstes/1222445 to your computer and use it in GitHub Desktop.
Save JoshuaEstes/1222445 to your computer and use it in GitHub Desktop.
Add this to the end of your ~/.bashrc to display what branch you are working in with git
parse_git_branch () {
git symbolic-ref HEAD 2> /dev/null | sed -e 's/\^0$//' | sed 's#refs\/heads\/\(.*\)#\1#'
}
BLACK="\[\033[0;38m\]"
RED="\[\033[0;31m\]"
RED_BOLD="\[\033[01;31m\]"
BLUE="\[\033[01;34m\]"
GREEN="\[\033[0;32m\]"
export PS1="$BLACK\u@\h:$GREEN\w $RED_BOLD\$(parse_git_branch)$BLACK \$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment