Fix git bash prompt for detached head state

This commit is contained in:
Talia 2018-12-04 10:31:34 +01:00
parent 3793618a36
commit 5f1860089e
1 changed files with 3 additions and 3 deletions

6
bashrc
View File

@ -64,11 +64,11 @@ git__prompt () {
if [ -z $branch ]
then
head=`git rev-parse --short HEAD 2>&1`
if [ "$head" == ".*fatal.*" ]
if [[ "$head" =~ fatal* ]]
then
branch='#'"$head"
else
branch='{no commits}'
else
branch='#'"$head"
fi
fi
if [ "$branch" = 'master' ]