title: How to run 'git diff --check' on certain file types only
body: <p>I have been unable to figure out how to run 'git diff --check' on only Python files in my commit. I have a commit with 3 files in it: </p>
  
  <pre><code>$ git show --name-only
  ...
  tools/gitHooks/preReceive.py
  tools/gitHooks/unittests/testPreReceive.py
  Makefile
  </code></pre>
  
  <p>The last 2 files have trailing whitespace in them.</p>
  
  <pre><code>$ git diff --check HEAD~1 HEAD
  tools/gitHooks/unittests/testPreReceive.py:75: trailing whitespace.
  +newmock = Mock()
  Makefile:41: new blank line at EOF.
  </code></pre>
  
  <p>I would like to restrict the whitespace check to only Python files. Doing this gives me the correct files:</p>
  
  <pre><code>$ git diff --name-only HEAD~1 HEAD | grep ".py"
  tools/gitHooks/preReceive.py
  tools/gitHooks/unittests/testPreReceive.py
  </code></pre>
  
  <p>But when I pipe the filenames to 'git diff --check' (with or without xargs) I get the wrong output.</p>
  
  <pre><code>$ git diff --name-only HEAD~1 HEAD | grep ".py" | xargs git diff --check HEAD~1 HEAD --
  $
  $ git diff --name-only HEAD~1 HEAD | grep ".py" | git diff --check HEAD~1 HEAD --
  tools/gitHooks/unittests/testPreReceive.py:75: trailing whitespace.
  +newmock = Mock()
  Makefile:41: new blank line at EOF.
  </code></pre>
  
  <p>I also tried this as well as a few variations on it with no luck:</p>
  
  <pre><code>$ git diff --check HEAD~1 HEAD -- "*.py"
  $
  </code></pre>
  
  <p>Can anyone help? I feel like I'm close to the answer.</p>