Created
September 25, 2012 15:11
-
-
Save binarycleric/3782510 to your computer and use it in GitHub Desktop.
Git branch in prompt
This file contains hidden or 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/}") " | |
} | |
white='\[\e[37;1m\]' | |
green='\[\e[32;1m\]' | |
blue='\[\e[34;1m\]' | |
red='\[\e[31;1m\]' | |
nocolour='\[\e[0m\]' | |
user="\u" | |
export PS1="$green$user$white@$blue\h $red\W $white\$(parse_git_branch)\$$nocolour " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about
git branch | grep '*' | cut -d ' ' -f 2
:)