gitgitignore

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 gitignore:

/foo/bar

The folder is checked: it exists and it has the files to be ignored. gitignore is committed. However, I have a file where I make a moification and is inside my bar folder. When I type

git status

inside my 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 git status.


Solution

  • I'm guessing this folder has been checked into git before?

    Run git rm -r --cached <folder> and check again.