Skip to content

Instantly share code, notes, and snippets.

@thegrubbsian
Created August 8, 2012 21:27
Show Gist options
  • Save thegrubbsian/3298926 to your computer and use it in GitHub Desktop.
Save thegrubbsian/3298926 to your computer and use it in GitHub Desktop.
Branch Name in Bash Prompt
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ →\ \1/'
}
export PS1='\u\[\e[1;37m\]@\[\e[1;32m\]\h\[\e[1;37m\]:\[\e[1;31m\]\W\[\e[1;33m\]$(parse_git_branch)\[\e[0;39m\]> '
export PROMPT_COMMAND='echo -ne "\033]0;${PWD}\007"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment