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:


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

  • Redirect stdout and stderr when ampersand(&) is used between commands in bash
  • git: checkout files from another branch into current branch (don't switch HEAD to the other branch)
  • Configure git to allow cli push/pull without password prompt - netrc ignored?
  • .gitignore exclude folder but include specific subfolder
  • Share pre-initialized GIT repository
  • OS X 10.11 / Xcode 7.0.1 git push fails silently
  • 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.

  • Fork an existing read-only Git repository
  • Squashing or editing some commits before doing git-svn dcommit?
  • Which SCM system to use with Xcode 4 for a lone developer?
  • Grab the svn HEAD git commit number?
  • Git - Remove in between commit
  • Administrating a git repo without root permissions
  • 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.

    UPDATE: The -r is required.

    Git Baby is a git and github fan, let's start git clone.