Skip to content

Instantly share code, notes, and snippets.

@joshuaadrian
Created September 5, 2013 13:47
Show Gist options
  • Select an option

  • Save joshuaadrian/6450331 to your computer and use it in GitHub Desktop.

Select an option

Save joshuaadrian/6450331 to your computer and use it in GitHub Desktop.
Colored Bash profile with git/hg branch names. Place in your .bash_profile file.
export TERM=xterm-256color
DEFAULT=$"\e[38;5;247m"
PINK=$"\e[38;5;163m"
GREEN=$"\e[38;5;76m"
ORANGE=$"\e[38;5;208m"
RED=$"\e[38;5;160m"
BLUE=$"\e[38;5;26m"
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
hg_in_repo() {
hg branch 2> /dev/null | awk '{print "on "}'
}
hg_branch() {
hg branch 2> /dev/null | awk '{print $1}'
}
# export PS1="\n${PINK}\u ${RED}@ ${ORANGE}\h ${DEFAULT}in ${GREEN}\w ${DEFAULT}on ${BLUE}$(parse_git_branch) ${GREEN}\n$ "
export PS1="\n${PINK}\u ${RED}@ ${ORANGE}\h ${DEFAULT}in ${GREEN}\w ${BLUE}\$(parse_git_branch)${GREEN}\n$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment