EGit Auto-Merge and Conflict Resolution

Resolving conflicts in Git with Eclipse is easy in most of the cases. Git has a robust auto-merging implemented. Still, sometimes it will not work automatically. Then you got to resolve these conflicts manually. This topic should provide the necessary steps.

Identify a required merge

The down-arrow signals that there are commits in the remote (origin). These might cause a conflict.merge

egit_merge_1.png

Pull Remote Changes

Right-click / Team / Pull executes a "git pull" in the background. It will try to auto-merge ("git fetch FETCH_HEAD" followed by "git merge").

egit_merge_2.png

Conflict Detected

The red symbols signal a conflict that could not be resolved. Right-click on the conflicted source file and select Team / Merge Tool

egit_merge_3.png

Settings for the Merge Tool

Accept the default setting.

egit_merge_4.png

Resolve Conflicts

The Merge tool is handled similar to SVN conflict resolution. You have to do one at least one edit in the local (left) source file and save. Otherwise the conflicts will not be resolved. To ensure merging worked, open the source file in its default editor.

egit_merge_5.png

Stage the merged File

We need to add the merged file to the Index (Staging).

egit_merge_6.png

Commit the Merge to your Local Repo

This will create a new "Merge commit" in your local Repo.

egit_merge_7.png

Push Everything Back to Origin

If Eclipse refuses to push (authorization issues, etc.), running "git push origin master" (or "git push origin ") in the bash should work.

egit_merge_8.png

Checking For Possible Conflicts before Merging/Pulling

You can run a Comparison beforehand to an automatic merge to identify possible issues in auto-merging:

egit_compare_1.png

The Synchronize perspective will open and you are able to compare single files (red symbols signal conflicts).
Topic attachments
I Attachment Action Size Date Who Comment
egit_compare_1.pngpng egit_compare_1.png manage 149 K 13 May 2013 - 12:44 MatthesRieke  
egit_merge_1.pngpng egit_merge_1.png manage 79 K 13 May 2013 - 12:44 MatthesRieke  
egit_merge_2.pngpng egit_merge_2.png manage 131 K 13 May 2013 - 12:44 MatthesRieke  
egit_merge_3.pngpng egit_merge_3.png manage 155 K 13 May 2013 - 12:44 MatthesRieke  
egit_merge_4.pngpng egit_merge_4.png manage 22 K 13 May 2013 - 12:44 MatthesRieke  
egit_merge_5.pngpng egit_merge_5.png manage 108 K 13 May 2013 - 12:44 MatthesRieke  
egit_merge_6.pngpng egit_merge_6.png manage 141 K 13 May 2013 - 12:44 MatthesRieke  
egit_merge_7.pngpng egit_merge_7.png manage 137 K 13 May 2013 - 12:44 MatthesRieke  
egit_merge_8.pngpng egit_merge_8.png manage 146 K 13 May 2013 - 12:44 MatthesRieke  
Topic revision: r4 - 10 Apr 2015 07:38:25, EikeJuerrens
This site is powered by FoswikiCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback