Skip to content

Instantly share code, notes, and snippets.

@peteburtis
Created March 27, 2013 02:44
Show Gist options
  • Save peteburtis/5251160 to your computer and use it in GitHub Desktop.
Save peteburtis/5251160 to your computer and use it in GitHub Desktop.
I take credit for less than 10% of this. Sadly I've lost the source.
#add git branch to prompt; paste at the end of your .bash_profile
function parse_git_branch_and_add_brackets {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\[\1\]/'
}
PS1="\h:\W\[\033[0;31m\]\$(parse_git_branch_and_add_brackets)\[\033[0m\] \u\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment