title: git ignore all files of a certain type, except those in a specific subfolder
body: <p>I have a directory structure like this:</p>
  <ul>
  <li>root
  <ul>
  <li>folder1
  <ul>
  <li>abc.json</li>
  <li>def.json</li>
  <li>somedir
  <ul>
  <li>more.json</li>
  </ul>
  </li>
  </ul>
  </li>
  <li>folder2
  <ul>
  <li>qwe.json</li>
  <li>rty.json</li>
  </ul>
  </li>
  <li>spec
  <ul>
  <li>mock1.json</li>
  <li>mock2.json</li>
  <li>somedir
  <ul>
  <li>more_mocks.json</li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  <p>Now using a <code>.gitignore</code> I want to ignore all <code>*.json</code> files except for the ones in the <code>spec</code>.  I don't want to use a <code>.gitignore</code> in <code>folder1</code> and <code>folder2</code> because there are a ton of these and they will get added to a lot, and I'm sure I will forget to move the right <code>.gitignore</code> file in place.</p>
  <p>In addition, there may be more nested directories with JSON files, and this rule needs to apply to all subdirectories as well.</p>
  <p>So how do I ignore all files of a type, except for a certain subdirectory?</p>