EGit 和 Eclipse 修改 .gitignore 文件,但它不应该 [英] EGit and Eclipse modifies .gitignore file but it should not

查看:33
本文介绍了EGit 和 Eclipse 修改 .gitignore 文件,但它不应该的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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.

  1. git checkout .gitignore,我得到了好版本的文件
  2. 然后我进入 Eclipse 窗口
  3. 然后我回到终端并发出:git status,
  4. 我可以看到 .gitignore 现在被修改了.
  1. git checkout .gitignore, I get the good version of the file
  2. Then I go to Eclipse window
  3. Then I go back to terminal and issue: git status,
  4. 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 文件,但它不应该的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆