alex alex - 1 year ago 56
Git Question

Git warning about file change even if the file is being ignored?

For example, if I want to change a branch

git checkout testing
), I'll get this warning:

error: Your local changes to the following files would be overwritten by checkout:

But as you can see, the file is being ignored:

enter image description here

Why is this happening?

Answer Source

It seems that the file was being tracked before so you need to explicitly remove it once, by this command:

git rm --cached <file>

This is related to this topic: How to make Git "forget" about a file that was tracked but is now in .gitignore?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download