4

enter image description here 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?

1

3 Answers 3

5

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.

Sign up to request clarification or add additional context in comments.

Comments

4

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).

Comments

1

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.