title: How can I gitignore files in a directory structure but maintain the directory structure?
body: <p>Let's assume I have a dir structure like so:</p>
  
  <pre><code>app/
    uploads/
      .gitkeep
      images/
        .gitkeep
      videos/
        .gitkeep
      docs/
        .gitkeep
  </code></pre>
  
  <p>I want to keep the dir structure but not include the files within (except <code>.gitkeep</code> obviously). The docs say:</p>
  
  <blockquote>
    <p>A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.</p>
  </blockquote>
  
  <p>So, I would expect this to do the trick:</p>
  
  <pre><code>/app/uploads/**
  !/app/uploads/**/.gitkeep
  </code></pre>
  
  <p>This isn't working however. None of the subdirectories are being added.</p>