Fix bash git prompt error in fresh repositories
This commit is contained in:
parent
1a469f9e35
commit
85cb17a8af
1 changed files with 15 additions and 8 deletions
13
bashrc
13
bashrc
|
@ -1,3 +1,4 @@
|
||||||
|
# vim: set noexpandtab :miv #
|
||||||
alias hello='echo "Hello :)"'
|
alias hello='echo "Hello :)"'
|
||||||
alias temp='watch -t -d -n 1 sensors -A coretemp-isa-0000'
|
alias temp='watch -t -d -n 1 sensors -A coretemp-isa-0000'
|
||||||
alias w='watch -t -d -n 1'
|
alias w='watch -t -d -n 1'
|
||||||
|
@ -62,12 +63,18 @@ git__prompt () {
|
||||||
# BRANCH
|
# BRANCH
|
||||||
if [ -z $branch ]
|
if [ -z $branch ]
|
||||||
then
|
then
|
||||||
branch='#'`git rev-parse --short HEAD`
|
head=`git rev-parse --short HEAD 2>&1`
|
||||||
|
if [ "$head" == ".*fatal.*" ]
|
||||||
|
then
|
||||||
|
branch='#'"$head"
|
||||||
|
else
|
||||||
|
branch='{no commits}'
|
||||||
fi
|
fi
|
||||||
if [ $branch = 'master' ]
|
fi
|
||||||
|
if [ "$branch" = 'master' ]
|
||||||
then
|
then
|
||||||
echo -ne " $blue$branch"
|
echo -ne " $blue$branch"
|
||||||
elif [ ${branch:0:1} = '#' ]
|
elif [ "${branch:0:1}" = '#' ]
|
||||||
then
|
then
|
||||||
echo -ne " $red$branch"
|
echo -ne " $red$branch"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue