Archived
1
0

Add 'git-UpdateCheck.sh'

This commit is contained in:
2020-11-25 12:54:29 +00:00
parent 8c9f712a66
commit 5c7c60d36c

17
git-UpdateCheck.sh Normal file
View File

@@ -0,0 +1,17 @@
#Git update checker
git remote update
UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse "$UPSTREAM")
BASE=$(git merge-base @ "$UPSTREAM")
if [ $LOCAL = $REMOTE ]; then
echo "Up-to-date"
elif [ $LOCAL = $BASE ]; then
echo "Need to pull"
elif [ $REMOTE = $BASE ]; then
echo "Need to push"
else
echo "Diverged"
fi