You should have the .project
file (as well as other files like .settings
and .classpath
) under version control, so that when you do a git clean
or a git reset --hard HEAD
you don't blow them away.
The .project
file has a few purposes:
- To store the name of the project
- To store the list of dependent projects
- To store the list of associated builders/natures
The file itself doesn't get updated regularly; only when you add a new nature or rename the project should it get cleaned. If you're using an old build tool then it might be re-writing the .project
file to add dependent projects in place; but usually that doesn't happen.
Does a git diff
show any changes on the file? It may be that there's a newline conversion issue, where git thinks that the file is different (because it has different EOLs) even though conceptually it's the same file.
You can also compare the content of the file against another branch using git diff HEAD..otherbranch -- .project
to just show that file change.
Finally, are you doing the replace in Eclipse or in an external tool like TortoiseGit? If the latter, you might be confusing Eclipse and it may be better to let Eclipse's JGit integration do the change for you.