EGit and Eclipse modifies .gitignore file but it should not

心已入冬 提交于 2019-11-28 18:26:35

问题


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.

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, 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.

How can it be?


回答1:


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.

You can disable this by going to Window > Preferences > Team > Git > Projects and deselect "Automatically ignore derived resources by adding them to .gitignore".

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).



来源:https://stackoverflow.com/questions/17748223/egit-and-eclipse-modifies-gitignore-file-but-it-should-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!