.gitignore not ignoring files

Nov 26th, 2013

I wanted to ignore log/development.log file in my git repository and the first thing which came to my mind was to add it to .gitignore file. So I added the following to my .gitignore file


This did not help. Why? After a little pondering and googling, I figured out that once a file is part of the git repository, you cannot ignore that file simply by adding to .gitignore.


  1. Commit any/all outstanding code commits to the git repository
  2. git rm --cached log/development.log
    This removed this file (log/development.log) from the index.
  3. git add .
    Add the file to the repository
  4. git commit -m "ignore the log/development.log file"
    Commit the file

This should do the task 🙂


No comments yet.

Time limit is exhausted. Please reload the CAPTCHA.