问题描述
我正在使用 Eclipse 和 EGit,但 Eclipse 修改了我的 .gitignore 文件,而我没有要求这样做.只要我打开 Eclipse,.gitignore 文件就会被修改.
I'm using Eclipse and EGit, but Eclipse modifies my .gitignore file without me asking to do so. As soon as I open Eclipse the .gitignore file is modified.
我已经向 .gitignore 添加了一些文件夹(通过 EGit),但之后删除了它们,但 Eclipse 不断向 .gitignore 添加已删除的行.
I've added some folders to .gitignore (through EGit) but removed them after, but Eclipse keeps adding removed lines to .gitignore.
git checkout .gitignore
,我得到了好版本的文件- 然后我进入 Eclipse 窗口
- 然后我回到终端并发出:
git status
, - 我可以看到 .gitignore 现在被修改了.
git checkout .gitignore
, I get the good version of the file- Then I go to Eclipse window
- Then I go back to terminal and issue:
git status
, - I can see that .gitignore is now modified.
怎么可能?
推荐答案
默认情况下,EGit 会自动将标记为Derived"的资源添加到 .gitignore
.一个典型的例子是包含已编译类的 Java 项目中的 bin
文件夹.
By default, EGit automatically adds resources marked as "Derived" to .gitignore
. A typical example is the bin
folder in a Java project containing the compiled classes.
您可以通过转到 Window > Preferences > Team > Git > Projects 并取消选择通过将派生资源添加到 .gitignore 来自动忽略派生资源"来禁用此功能.
You can disable this by going to Window > Preferences > Team > Git > Projects and deselect "Automatically ignore derived resources by adding them to .gitignore".
EGit 中还有一个错误,它会在 Eclipse 模型和文件系统不同步时添加条目,请参阅 错误 421610(已针对 EGit 3.5 修复).
There was also a bug in EGit where it added entries when the Eclipse model and the filesystem were out-of-sync, see bug 421610 (fixed for EGit 3.5).
这篇关于EGit 和 Eclipse 修改 .gitignore 文件,但它不应该的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!