title: gitignore all files in all subdirectories except xml files
body: <p>I have a directory structure similar to this:</p>
  
  <pre><code>root/
    .gitignore
    subdir/
      .gitignore
      subsubdir1/
        file.xml
        image.png
      subsubdir2
         file.xml
         image.jpg
  </code></pre>
  
  <p>I want to ignore all files from <code>subdir</code> except XML files.
  the second <code>.gitignore</code> looks like this:</p>
  
  <pre><code>*                   # ignore everything in this directory and its subdirectories
  !*/                 # do not ignore subdirectories
  !*.xml              # do not ignore xml files
  !.gitignore         # and of course have this .gitignore file included too
  </code></pre>
  
  <p>according to <a href="https://stackoverflow.com/questions/9162919/git-whitelisting-files-in-a-complex-directory-structure">this</a> and various other posts here on SO and other sites, this should work just fine, but for some reason <code>git status</code> shows me that all the files in <code>subdir</code> folder are untracked.</p>
  
  <p>I have used <code>git rm --cached</code> to remove all files that have been tracked before <code>.gitignore</code> was added, but that still did not do the trick.</p>
  
  <p>Do you have any clue, what would fix this ?</p>
  
  <p>P.S.:
  In case it matters I am using git on Windows.</p>