From 5f1860089e134b361cbc7b78561b9e02b7668c9e Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Tue, 4 Dec 2018 10:31:34 +0100 Subject: [PATCH] Fix git bash prompt for detached head state --- bashrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bashrc b/bashrc index 6437ef5..b6d0a8a 100644 --- a/bashrc +++ b/bashrc @@ -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' ]