title: git diff between local branch and remote tracking branch
body: <p>I simply want to get a non-zero exit code if there is a diff between a local branch and the remote tracking branch.</p>
  
  <p>For example, say the local branch is foo, and I have it checked out, so the diff command would be:</p>
  
  <pre><code>git fetch origin
  git diff --exit-code remotes/origin/foo
  </code></pre>
  
  <p>However, my question is - is there a generic/programmatic way to run this kind of diff command for any local branch? I want to diff a local branch with the remote tracking branch, generically.</p>