#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