title: Ignore files in git log -p
body: <p>I'm trying to summarize my work on a project. The problem is that I do not want to include test files in the output of <code>git log --patch</code>.</p>
  
  <p>The files are in a single directory called <code>mtest</code>; however, that folder also contains test suite code that I do want to show. Test files, which I want to exclude, have extension <code>mscx</code> or <code>xml</code>, so I would want the filter to work based on that.</p>
  
  <p>I have looked at <a href="https://stackoverflow.com/questions/5685007/making-git-log-ignore-changes-for-certain-paths">Making &#39;git log&#39; ignore changes for certain paths</a> but this looks like it excludes commits that modified a file instead of simply excluding the file.</p>
  
  <p>Is there a way to do this?</p>
  
  <p>I have tried Jubobs answer, and it seemed worked, but surprisingly 2 files came up even with the filter on.</p>
  
  <p>I have reproduced this with this small repository:</p>
  
  <pre><code>mkdir test
  cd test
  git init
  echo 'readme' &gt; README
  git add .
  git commit -m "Initial commit"
  
  mkdir test2
  cd test2
  echo 't1' &gt; test1.cpp
  echo 't2' &gt; test2.xml
  git add .
  git commit -m "c2"
  
  echo 't3' &gt; test3.cpp
  echo 't4' &gt; test4.xml
  git add .
  git commit -m "c3"
  </code></pre>
  
  <p>I noticed that files are not filtered when a directory is created.
  I have tried the following commands:</p>
  
  <pre><code>git log --patch -- . ":(exclude)**/*.xml"
  </code></pre>
  
  <p>which resulted in <strong>both</strong> xml files to be included.</p>
  
  <pre><code>git log --patch -- . ":(exclude)*.xml"
  </code></pre>
  
  <p>This surprisingly filters out the <code>test4.xml</code> but not <code>test2.xml</code>. </p>