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 up-to-date.' && changed=1 But it is rather heavy. Is there a better way? The ideal solution would check all the remote branches, and return names of the changed branches and the number of new commits in each one.