Created
June 13, 2009 09:13
-
-
Save galfert/129157 to your computer and use it in GitHub Desktop.
Show the git branch in bash prompt
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 { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "("${ref#refs/heads/}")" | |
} | |
GREEN="\[\033[01;32m\]" | |
WHITE="\[\033[00m\]" | |
BLUE="\[\033[01;34m\]" | |
YELLOW="\[\033[0;33m\]" | |
PS1="$GREEN\u@\h$WHITE:$BLUE\w $YELLOW\$(parse_git_branch)$WHITE\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment