How do I check whether the remote repository has changed and I need to pull?
Now I use this simple script:
git pull --dry-run | grep -q -v \'Already
I based this solution on the comments of @jberger.
if git checkout master && git fetch origin master && [ `git rev-list HEAD...origin/master --count` != 0 ] && git merge origin/master then echo 'Updated!' else echo 'Not updated.' fi