gitgitignore

Gitignore not working


My .gitignore file isn't working for some reason, and no amount of Googling has been able to fix it. Here is what I have:

*.apk
*.ap_
*.dex
*.class
**/bin/
**/gen/
.gradle/
build/
local.properties
**/proguard/
*.log

It's in the directory master, which is my git repo. I'm running Git 1.8.4.2 because I'm on a MacBook running OSX 10.8.6.


Solution

  • The files/folder in your version control will not just delete themselves just because you added them to the .gitignore. They are already in the repository and you have to remove them. You can just do that with this:

    Remember to commit everything you've changed before you do this!

    git rm -rf --cached .
    git add .
    

    This removes all files from the repository and adds them back (this time respecting the rules in your .gitignore).