title: Why does git ignore all files in a directory except one?
body: <p>I know there are many questions on how to ignore directories, and I usually haven't had any problem until now, but now I'm stuck with something I don't understand.</p>
  
  <p>Here is my directory structure:</p>
  
  <pre><code>/src
  /war
    com.example.MyProject/
    WEB-INF/
      classes/
      deploy/
      lib/
  </code></pre>
  
  <p>I want to ignore content of directories <code>classes/</code>, <code>deploy/</code> and <code>com.example.MyProject/</code>, and here is my .gitignore file:</p>
  
  <pre><code>*.log
  war/WEB-INF/classes/
  war/WEB-INF/deploy/
  com.example.MyProject/
  </code></pre>
  
  <p>Files under <code>com.example.MyProject/</code> are automatically generated, and git ignores all of them except for a file named <code>com.example.MyProject.nocache.js</code>. In fact, when I do <code>git status</code> I get:</p>
  
  <pre><code># On branch myBranch
  # Changed but not updated:
  #   (use "git add &lt;file&gt;..." to update what will be committed)
  #
  #       modified:   .gitignore
  #       ......
  #       modified:   war/com.example.MyProject/com.example.MyProject.nocache.js
  </code></pre>
  
  <p>Why does git refuse to ignore that single file in that directory? What am I doing wrong?</p>