如何使用 EGit 忽略已在 Eclipse 中的 GIT 存储库中提交的文件?

How to ignore a file already committed on GIT repository in Eclipse using EGit?

我尝试忽略 Eclipse EGit 上已提交的“.project”文件,而不是将其从我的 Eclipse 项目或存储库中删除。

我有这个需求:

我们正在从 SVN 迁移到 GIT:在 SVN 上,我们没有遇到此类问题,因为我们可以 不提交 一些文件。在 GIT,似乎我们必须提交我们修改的所有内容,这样我们才不会发生冲突。

有人可以帮我吗?

谢谢!

右键单击 文件并选择团队 > 高级 > 假设不变

Eclipse Help - EGit Documentation - EGit User Guide - Reference:

Resources can be flagged "assume unchanged". This means that Git stops checking the working tree files for possible modifications, so you need to manually unset the bit to tell Git when you change the working tree file. This setting can be switched on with the menu action Team > Assume unchanged and switched back with the menu action Team > No Assume unchanged.

需要注意的是每个同事必须做一次。 服务器端 Git 挂钩 可以拒绝提交更改 .project 如果同事忘记这样做。