Archived
1
0
This repository has been archived on 2023-11-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
linux/git-UpdateCheck.sh

18 lines
454 B
Bash

#Git update checker
## Will folow localy checked-out branch
## Make sure localy altered files (config,upload folder, etc) are setup in .gitignore
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 "Update available, Pulling form git"
git pull
else
echo "Diverged"
fi