vitess.io/vitess@v0.16.2/misc/git/ps1 (about) 1 # Source this file in your shell to get the current git branch name in 2 # the prompt. 3 4 # parse_git_branch echoes the name of the current branch followed by a 5 # space (if its not nil). 6 function parse_git_branch { 7 branch=$(git branch --no-color 2> /dev/null |grep '*'|awk '{print $2}') 8 if [ ! -z $branch ]; then 9 echo " $branch" 10 fi 11 } 12 PS1='\A [\j] (\u \[\e[1;34m\]\h\[\e[m\]):\w\[\e[0;31m\]$(parse_git_branch)\[\e[m\]\$ '