.gitignore file not ignoring it’s specified files

Problem

You have a repository with a .gitignore file. However, the files are still showing tracked changes.

Solution

  1. Using GIT Bash, navigate to the repository folder (e.g. “cd C:\Projects\Web”)
  2. Make sure you commit any changes before proceeding to the next step.
  3. Run this command to empty the repository’s index: git rm -r --cached .
  4. Once that has finished, run this command to reindex: git add .
  5. Make a new commit, e.g. git commit -m "Reindexed to fix .gitignore"

Leave a comment

Your email address will not be published. Required fields are marked *