mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
Check git status before update
This commit is contained in:
parent
cfd49f7566
commit
df42d91c8b
@ -108,10 +108,22 @@ function update_gs {
|
||||
BRANCH='master'
|
||||
fi
|
||||
|
||||
MESSAGE="Requires GitHub Installation"
|
||||
echo_info
|
||||
GIT_CHECK=$(git status | awk '{print $1}')
|
||||
if [ $GIT_CHECK == "fatal:" ]
|
||||
then
|
||||
MESSAGE="Requires GitHub Installation"
|
||||
echo_warn
|
||||
exit_nochange
|
||||
elif [ $GIT_CHECK == "HEAD" ]
|
||||
git fetch --all
|
||||
git reset --hard origin/${BRANCH}
|
||||
else
|
||||
MESSAGE="This might break..."
|
||||
echo_warn
|
||||
git fetch --all
|
||||
git reset --hard origin/${BRANCH}
|
||||
fi
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user