Today one of my project’s .gitignore did not work.
I was terrified, googled and found a solution to fix this :)
git rm -r --cached .
This removes everything from the index, then just run:
git add .
git commit -m ".gitignore is now working"
And these actions beautifully fix the broken .ignore
Be aware to commit all your changes before, otherwise you will loose control on all the changed files