title: Allow only some files in subdirectories with .gitignore
body: <p>I have dir structure like this:</p>
  
  <pre><code>static
      admin
      ajax_upload
      books
      css
      font
      media
      robots.txt
  templates
  src
  build
  lib
  </code></pre>
  
  <p>I want to <strong>ignore</strong> following direcotories: </p>
  
  <ul>
  <li>lib</li>
  <li>build</li>
  <li>src</li>
  <li>static</li>
  </ul>
  
  <p>I want to <strong>allow</strong> following: </p>
  
  <ul>
  <li>static/css/bootstrap-styled.css</li>
  <li>static/css/main.css</li>
  <li>static/css/font-*.css</li>
  <li>static/font</li>
  <li>static/media/default.png</li>
  <li>static/robots.txt</li>
  <li>templates</li>
  </ul>
  
  <p>So I use the following .gitignore:</p>
  
  <pre><code># Ignore
  /lib
  /src
  /build
  /static/*
  
  # Allow
  !/static/css/bootstrap-styled.css
  !/static/css/main.css
  !/static/css/font-*.css
  !/static/font
  !/static/media/default.png
  !/static/robots.txt
  </code></pre>
  
  <p>But it doesn't work properly. Could you help me - what I do wrong here? TIA!</p>
  
  <p><strong>Details</strong></p>
  
  <p>Real project structure is like this:</p>
  
  <pre><code>static
      admin
          css
          img
          js
              admin
      ajax_upload
      books
      css
      font
      media
          uploads
              blog
              gallery
          default.png
      robots.txt
  templates
  src
  build
  lib
  </code></pre>