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
The below script works perfectly.
changed=0 git remote update && git status -uno | grep -q 'Your branch is behind' && changed=1 if [ $changed = 1 ]; then git pull echo "Updated successfully"; else echo "Up-to-date" fi