The image says it all. Why is git telling me that I've changed the file when I'm explicitly telling it to ignore it?

- 13,666
- 16
- 54
- 89
-
1possible duplicate of [Making git "forget" about a file that was tracked but is now in .gitignore](http://stackoverflow.com/questions/1274057/making-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore) – 1615903 Sep 24 '15 at 05:01
3 Answers
A .gitignore
specifies files that should not be added to git
's index. It does not prevent changes to files that are already in the index.
If you want to remove the file completely from the index, you will need to commit a deletion of that file. Then if the file gets recreated (and it is still listed in .gitignore
), it will not be re-added to the index.

- 19,884
- 8
- 59
- 78
you have to remove it from the repository and then commit it.
git rm -rf --cached .idea/*
git add -A .
git commit -m "Removed idea files"
git push
And now all your .idea
files will be ignored (if added to the .gitignore
as described above).

- 128,036
- 21
- 144
- 167
You may have added the file previously, making it tracked. If it gets added to the .gitignore
file after that, Git will still report changes to it because it is a tracked file.
You need to remove the file from the index and create a new commit.

- 5,177
- 23
- 27