Git ignore doesn't ignore the specified folders/files
<p>I want my .gitignore to ignore certain folders and files so I came up with the following:</p>

<pre><code>*.class

# usual java ignores
bin/
.metadata

# Maven
*/target/*
target/*
/target/
*/deploy/*
deploy/*

# src-gen folder is populated by the command of protobuf, these files should not be pushed
src-gen/*

# eclipse generated stuff
dependency-reduced-pom.xml

# we shouldn't have .jar files in our repository, 
# apart from these 5 jars which are vital for our build process
*.jar
!/projectName/bundle/**/*.jar

# For Unix editors 
# sometimes make file copies ending
# with ~
# To ignore them use:
*~

# For Mac
.DS_Store
._*

# For markdown read me files
.README.md.html
</code></pre>

<p>However, after a <code>git status</code> I cannot see anything to be deleted as output. Note that this is a submodule, if that matters at all. And I want this <code>.gitignore</code> to ignore everything without specifying any folder name, since I don't want any hardcoding.</p>

<p>Here is the folder structure I have:</p>

<pre><code>+ parentRepo
  + thisRepo
    + .gitignore
    + projectName
      + src-gen
      + target
      + deploy
      + dependency-reduced-pom.xml
      + bundle
        + system
          + 1.jar
          + 2.jar
          + 3.jar
          + 4.jar
          + 5.jar
</code></pre>