title: How can I update local repositories only if remotes are ahead
body: <p>Hello guys I am currently working under windows (puke) , but I want to write simple bat file that executes every 15 minutes checks if my local repos are behind master remote repository and pulls if true otherwise wait another 15 minutes (time is not important actually). So far I've done this , but it doesn't seem to work also I haven't figured out how I will keep the file executing.. schtask?</p>
  
  <pre><code>@echo off
  
  CD /d D:\Repositories\Mobile\mobile
  git checkout master
  FIND "behind" | git status -uno
  IF %errorlevel% EQU 0     
  git pull
  
  CD /d D:\Repositories\website\website
  git checkout master
  FIND "behind" | git status -uno
  IF %errorlevel% EQU 0     
  git pull
  
  EXIT
  </code></pre>