Check git status before update

This commit is contained in:
Michael Stanclift 2020-05-30 22:37:06 -05:00
parent cfd49f7566
commit df42d91c8b

View File

@ -108,10 +108,22 @@ function update_gs {
BRANCH='master' BRANCH='master'
fi fi
MESSAGE="Requires GitHub Installation" GIT_CHECK=$(git status | awk '{print $1}')
echo_info if [ $GIT_CHECK == "fatal:" ]
then
MESSAGE="Requires GitHub Installation"
echo_warn
exit_nochange
elif [ $GIT_CHECK == "HEAD" ]
git fetch --all git fetch --all
git reset --hard origin/${BRANCH} git reset --hard origin/${BRANCH}
else
MESSAGE="This might break..."
echo_warn
git fetch --all
git reset --hard origin/${BRANCH}
fi
exit exit
} }