Certification Exams Pro

Resolve Conflicts in GitHub Desktop 00

 ·  PT34M04S  ·  EN

Step by step guide to fix merge conflicts using GitHub Desktop and finish the merge without drama

Fix merge conflicts in GitHub Desktop by reviewing conflicted files choosing changes and committing the merged result.

  1. Fetch and switch to the target branch
  2. Pull or merge the incoming branch
  3. Open conflicted files in an editor
  4. Resolve conflicts by selecting or editing changes
  5. Mark resolved commit and push

1 Fetch and switch to the target branch

Open GitHub Desktop and select the branch that should receive the merge. Click Fetch origin to get the latest remote state then switch branches if a different working branch is required.

2 Pull or merge the incoming branch

Use Pull origin to bring remote commits. To merge from another branch choose Branch menu then Merge into current branch and pick the source branch. GitHub Desktop will detect conflicts and list conflicted files in the Changes view.

3 Open conflicted files in an editor

Click a conflicted file in the Changes list to view conflict markers. For more control use Repository menu and choose Open in Visual Studio Code or another preferred editor to see both versions side by side.

4 Resolve conflicts by selecting or editing changes

For straightforward cases use the Choose mine and Choose theirs buttons that appear in the GUI. For custom merges edit the file by removing conflict markers and combining lines into the desired final content. Save the file to register the resolution in the Changes view.

5 Mark resolved commit and push

When all conflicted files are resolved the Commit merge button will become active. Add a clear commit message then Commit merge. Then Push origin to send the merged branch to remote and enjoy version control peace.