title: .gitignore to ignore all files, then recursively allows files of a certain type
body: <p>I have a folder that is purely a T4 template folder but it outputs code generated files into other directories.  So I'm looking to ignore everything except *.tt files (i.e. the *.cs, *.master, *.resx, etc.).  There is one gotcha.  I have a subfolder called static that contains files that should never be ignored.</p>
  
  <pre><code>/Test.tt
  /Test.cs
  /TestHtml.tt
  /TestHtml.html
  /Static
     /Sub/Sub.cs
     /Sub/Sub2/Sub2.cs
     /Sub3/Sub4/Sub5/Sub5.html
  </code></pre>
  
  <p>I <em>only</em> want to ignore the /Test.cs and /Test.html but include all other files.  I've tried the following:</p>
  
  <p>/.gitignore</p>
  
  <pre><code># Ignore all
  *
  
  # But not these files...
  !.gitignore
  !*.tt
  </code></pre>
  
  <p>/Static/.gitignore</p>
  
  <pre><code>!*.*
  #also have just tried blank
  </code></pre>
  
  <p>I can't get git to ignore the right things...main problem is the 'recursive exclude' I want for Static/<em>.</em>.</p>