Resolving merge conflicts with the Simple Merge tool

You can resolve merge conflicts by using the Simple Merge tool.

About this task

When a Git repository in EGit contains merge conflicts, the projects from that repository have a red double diamond icon displayed in the Package Explorer or Enterprise Explorer view. You must resolve all conflicts before you can check in your changes.

The corresponding repository in the Git Repositories view includes Conflicts next to the repository name.

Procedure

To resolve merge conflicts in a repository in Rational Application Developer:

  1. In the Enterprise Explorer or Project Explorer view, right-click the corresponding project or file with a merge conflict, and click Team > Simple Merge Tool.

    The Merge Editor view opens and displays the files with merge conflicts. If you right-click a folder and click the Simple Merge tool, it opens a Merge Editor view for each file with a conflict that is found in the folder or its subfolders. If you right-click an individual file with a conflict and click the Simple Merge tool, it opens a Merge Editor view for only that file.

    The following image shows the Merge Editor view for the RepositoryTreeDialog.java file:

    The left pane of the editor displays the preview version of the file. The right pane displays the final version. The Preview pane contains the Git conflict markings in the file and marks each side of the conflict. Conflicts are mapped to the right pane of the editor and have the merge conflict removed. The mapping indicates where the final version of the conflict lies in the file.

  2. Hover over the small nodes that link the changed lines between the panes, and click the copy icon that is displayed.

    The corresponding version of the conflict is rendered in the right pane of the editor.

    If you change your mind about which version to use, click the other version’s copy icon to replace the existing content in the right pane.

    In many conflicts, you might have to manually customize changes rather than choose one version or the other. You can edit the material in the right, or Final, pane. You can copy one version of the conflict, and customize it further, or you can edit directly in the Final pane.

  3. Optional: Use the two icons that are located in the top-right corner of the editor to advance between conflicts. Correct the conflicts as applicable.
  4. After you resolve all conflicts, click the save icon in the top-right corner.

    The saved files are displayed in the Staged Changes section of the Git Staging view. In the Git Staging view, you can commit or commit and push your merge conflict resolutions.