Created
July 22, 2014 14:49
-
-
Save tao12345666333/4a81478aa5db7c30e94e 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
function git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return; | |
echo "("${ref#refs/heads/}") "; | |
} | |
PS1="[\[\e[1;35m\]\u\[\e[1;32m\]\w\[\e[0m\]] \[\e[0m\]\[\e[1;36m\]\$(git_branch)\[\e[0;33m\]\$" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment