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 temp='watch -t -d -n 1 sensors -A coretemp-isa-0000'
|
||||
alias w='watch -t -d -n 1'
|
||||
|
@ -62,12 +63,18 @@ git__prompt () {
|
|||
# BRANCH
|
||||
if [ -z $branch ]
|
||||
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
|
||||
if [ $branch = 'master' ]
|
||||
fi
|
||||
if [ "$branch" = 'master' ]
|
||||
then
|
||||
echo -ne " $blue$branch"
|
||||
elif [ ${branch:0:1} = '#' ]
|
||||
elif [ "${branch:0:1}" = '#' ]
|
||||
then
|
||||
echo -ne " $red$branch"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue