Skip to content

Instantly share code, notes, and snippets.

@ConnorDoyle
Created March 6, 2014 17:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ConnorDoyle/9395589 to your computer and use it in GitHub Desktop.
Save ConnorDoyle/9395589 to your computer and use it in GitHub Desktop.
Git Branch - Bash Profile
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
yellow=$(tput setaf 3)
green=$(tput setaf 2)
cyan=$(tput setaf 6)
purple=$(tput setaf 5)
bold=$(tput bold)
reset=$(tput sgr0)
export PS1='\[$yellow$bold\]\u\[$reset\]@\[$cyan$bold\]\H\[$reset\]:\W\[$green$bold\]$(parse_git_branch) \[$purple$bold\]\$\[$reset\] '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment