Skip to content

Instantly share code, notes, and snippets.

@lenn0x
Created August 30, 2009 05:47
Show Gist options
  • Save lenn0x/177871 to your computer and use it in GitHub Desktop.
Save lenn0x/177871 to your computer and use it in GitHub Desktop.
Git Show Branch in Bash
function parse_git_branch {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
GREEN="\[\033[1;32m\]"
YELLOW="\[\033[1;33m\]"
WHITE="\[\033[0;0m\]"
PS1="[\u@\h [$GREEN\W$YELLOW\$(parse_git_branch)$WHITE]\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment