title: How do I use git diff -G?
body: <p>I'm writing a little test suite that runs the tool to be tested over a bunch of input files. For each input file, a corresponding output file is being created by the tool (both are in XML). Input and output files are checked in on a Git repo.</p>
  
  <p>The output files carry the time when the tool was compiled, so the output files are surely modified after they were re-created by the tool being tested.</p>
  
  <p>To have a quick glimpse if the output has changed (when I modified the sources of the tool), I'd like to check whether the content of the node <code>OutputFingerprint</code> has changed (simple hash over the contents of the relevant parts of the output file).</p>
  
  <p>Reading the manual for <a href="http://git-scm.com/docs/git-diff" rel="noreferrer"><code>git-diff</code></a>, I found that there's a <code>-G</code> option:</p>
  
  <blockquote>
    <p><strong>-G&lt;regex&gt;</strong><br>
    Look for differences whose added or removed line matches the given &lt;regex&gt;.</p>
  </blockquote>
  
  <p>Unfortunately, they provide no example for how to use the <code>-G</code> option. </p>
  
  <p>My first thought was to simply write </p>
  
  <pre><code>git diff -GOutputFingerprint
  </code></pre>
  
  <p>but that's wrong:</p>
  
  <pre><code>&gt; git diff -GOutputFingerprint
  error: invalid option: -GOutputFingerprint
  </code></pre>
  
  <p>Next thought was to put the regex in slashes, which is also not successful:</p>
  
  <pre><code>&gt; git diff -G/OutputFingerprint/
  error: invalid option: -GC:/Program Files/Git/OutputFingerprint/
  </code></pre>
  
  <p>Also, simply putting a space between <code>-G</code> and <code>OutputFingerprint</code> doesn't work:</p>
  
  <pre><code>&gt; git diff -G OutputFingerprint
  fatal: ambiguous argument 'OutputFingerprint': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions
  </code></pre>
  
  <p>When I call <code>git diff</code> without any params, I get the modification:</p>
  
  <pre><code>-    &lt;OutputFingerprint&gt;e45807ca76fc5bb78e9e928c6fb7eed6&lt;/OutputFingerprint&gt;
  +    &lt;OutputFingerprint&gt;d0846851bc9d52b37f7919def78660a2&lt;/OutputFingerprint&gt;
  </code></pre>
  
  <p>Another thought was to use <code>git diff -S".*OutputFingerprint.*" --pickaxe-regex</code>, but this is also not successful.</p>
  
  <p><code>git --version</code> gives me <code>git version 1.7.3.1.msysgit.0</code> if that is relevant. </p>
  
  <p>When I ask <code>git diff --help</code>, the provided manual shows me the <code>-G</code> option.</p>
  
  <p>So, could anyone provide me an example for how to use <code>git diff -G</code> correctly? </p>