5

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

Staging

Joshua Fox
  • 18,704
  • 23
  • 87
  • 147

2 Answers2

3

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.

Kai
  • 38,985
  • 14
  • 88
  • 103
  • You are right that after I do "Mark as merged," then commit, Team Synchronization still shows the conflict icon, but Git staging does not. So, at this point, it would seem that the conflict is resolved, but the conflict icon is wrong. – Joshua Fox Aug 23 '16 at 14:16
  • 1
    No it's correct. There is still a conflict between your local working copy (now with the changes you made and commited locally) and the remote repository. You need to do a `pull` to have this conflict in your local repo and working copy. After the `pull` you see it in the `Git Staging` view and you will be able to fix it. – Kai Aug 23 '16 at 16:26
  • 1
    "You need to do a pull." Thank you. Pull is of course not possible until I commit. After adding the merged code to index from Git Staging view, I fetched, then committed the code from Resource view. Then, from Resource view I compared to the remote branch. Now, those conflict icons are no longer there. – Joshua Fox Aug 25 '16 at 10:25
1

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.

Chandrayya G K
  • 8,719
  • 5
  • 40
  • 68
  • 1
    Thank you, but "Mark as Merged" is one of the things I tried, and it did not eliminate the icon. – Joshua Fox Aug 06 '16 at 17:34
  • 1
    I did "Mark as merged," then Commit. Now, Team Synchronization (Compare To) still shows the conflict icon, but Git staging does not. – Joshua Fox Aug 23 '16 at 14:16
  • To clear these conflict icons. Re-run the **Synchronization** once more time, then new results will clear these old icons. – Chandrayya G K Aug 24 '16 at 07:25
  • In Eclipse IDE for PHP Developers Version: 2020-03 (4.15.0), after resolve the conflicts, right click in the conflict file and "Add to index" (as shown in the video). You can also remove from index and the conflict icon will no longer appear. – Lord_Dracon Jun 03 '22 at 17:16