Created
August 30, 2009 05:47
-
-
Save lenn0x/177871 to your computer and use it in GitHub Desktop.
Git Show Branch in Bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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