There is nothing changed, but eclipse egit marks the file as changed

断了今生、忘了曾经 提交于 2019-11-26 10:21:15

问题


I\'m using eclipse egit with github. I found something strange that I didn\'t change anything, but egit marked the file as \"changed\". See the images:

  1. the file \"run.bat\" is marked as \"changed\"

    \"enter

  2. Compare with \"file in Git index\", you can see nothing is different

    \"enter

  3. Compare with \"file in HEAD\", you can see nothing is different neither

    \"enter

My friend uses mac and I use windows, but we all configured git as \"commit unix lineend\".. I also checked the lineend of my source and the HEAD, they are the same(I configured git to convert them to \"\\r\\n\" when pulling)

Where is wrong? Is it a bug of Egit?


回答1:


One of the first things I've had issues with in Git.

I've said this forever:

git config --system core.autocrlf false

To get rid of CR highlighting in diff and patch views, use:

git config --system core.whitespace cr-at-eol

If you share your computers with others, replace '--system' with '--global'.




回答2:


Eclipse Preferences / Team / Git / Configuration / User Settings

("core" section)

key: autocrlf
value: false

The key should already exist, so just need to edit the value.

If creating a new key then use core.autocrlf.




回答3:


As a follow up, as I just ran into the same issue, another reason for EGit detecting all files as changed is a POSIX file permission problem at least when used together with Cygwin's git.

The following will fix that; however keep in mind that this also means that they are ignored then:

$ git config core.filemode false




回答4:


For eclipse specific issues for linefeed, you can also change the return character in Eclipse Preferences where you can change the New text file line delimiter from Windows syntax to Unix which should help.




回答5:


you can ignore whitespace differences with Eclipse settings under Compare/Patch. Preferences-->General-->Compare/Patch,you can find the "Ignore white space" in the right,and select this option.




回答6:


I also have the same issue from the Eclipse git commit is showing this issue

once modified file and finally removed the changes from the file even though it showing the file in Un staged changes section.

Solution:
Eclipse -> Window -> Preferences -> Team -> Git -> Configuration -> User Settings (right side tab)

click on Add Entry

Key  : core.autocrlf
Value: true

click on Ok then click on Apply -> Ok Refresh your "Git Staging tab" or check the Team -> commit option. now it will only show the exact changes only.




回答7:


In General->Workspace. Select Text encoding UTF-8



来源:https://stackoverflow.com/questions/8227233/there-is-nothing-changed-but-eclipse-egit-marks-the-file-as-changed

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