Created
June 29, 2014 09:15
-
-
Save twmht/e95f0495053bc6a1a7c5 to your computer and use it in GitHub Desktop.
show git branch in bash shell
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
# show git branch | |
function git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return; | |
echo "("${ref#refs/heads/}")"; | |
} | |
PS1="${HOSTNAME}:\w\[\033[1;32m\]\$(git_branch)\[\033[0m\]$"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment