How can I get rid of Eclipse Git “conflict” icons after all merges are resolved?

为君一笑 提交于 2020-01-04 01:28:49

问题


I get the Git conflict icon in Eclipse on lots of files, even though it seems that I resolved any possible conflicts.

In Eclipse 4.5.2, in the Project view, I select a project root and do right-click -> Compare to branch origin/master. Next, we see the Team Synchronization view. Many files show a red conflict icon., but they should not.

The Git staging view, which is supposed to show conflicts, is empty. I already tried Merge; Committing the merge (nothing remains to be committed). I tried Add to Index from the Git Staging view; and even Overwrite from the Team Synchronization view. Comparing the local and origin files shows that they are identical.

Git setting autocrlf is true, so that is not the issue.

This occurs repeatedly.

Why do I see this conflict icon? How can I get rid of it?


回答1:


Did you do a pull? Or where you just comparing in Team Synchronization? In my experience the Team Synchronization perspective confuses the most people.

In general it should be used "read-only". Don't try to resolve any conflicts here. Per default you are comparing your working copy against the remote repository. Which means you actually have no conflict in your working copy. When you "fix" them here you are just making a local modification. You can commit that but it doesn't resolve any conflict. It makes the actual conflict even harder to resolve.

So don't do anything in the Team Synchronization perspective. Just do a pull to have those conflicts in your working copy and then resolve them. A merge conflict is marked as merged by moving them to the Staged Changes.

If something breaks and you want a new try do a reset --hard on the last commit in your local repository.




回答2:


After editing the conflict resource properly. Right click on the conflict resource and click on *Mark as Merged". See Resolving_a_merge_conflict. Also check this screen cast.



来源:https://stackoverflow.com/questions/38768660/how-can-i-get-rid-of-eclipse-git-conflict-icons-after-all-merges-are-resolved

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