gitignore does not ignore folder
In the root of my project I have a
foo folder. Inside the
foo folder I have a
bar folder. I would like to ignore all changes to all files inside my
bar folder. I have this in my
The folder is checked: it exists and it has the files to be ignored.
committed. However, I have a file where I make a moification and is inside my
bar folder. When I type
git bash I see the file which should have been ignored. What could be the reason and how can I successfully ignore all files inside my bar folder?
Note, that the files were previously ignored with the same line, but I had to temporarily remove that line to
commit something on the server. After the
commit, I put back the line into the
gitignore. This was a while ago, but now I have observed that the files will be in
git status. I would expect to be able to modify the ignored files without they appearing in the
One Solution collect form web for “gitignore does not ignore folder”
I’m guessing this folder has been checked into git before? Try running
git rm --cached <folder> and check again.
EDIT: The code had a little bug in it. The solution was:
git rm -r --cached <folder>
However, this answer has led me to the solution, so I will accept it.
-r is required.