Skip to content

Resolving Code Conflicts

Kumar Damani edited this page Feb 8, 2019 · 1 revision

This document is intended for developers to resolve conflicts from pull requests

The Scenario:

I want to merge my (dev.) branch "feat/35" into the (target) branch "QA".

  1. I start to create a pull request from GitHub.com for this merge directly
  2. I notice that there are some conflicts reported in the preview
  3. I cannot continue this merge as is, I have to fix this pull request such that no conflicts show up for the reviewers.

If you have already created a pull request with reviewers, and conflicts, please delete this request.

How to resolve this scenario?

  1. Create a (temp) branch from QA (the target branch) called "qa-temp-merging-feat35" or something similarly obvious.
  2. Ensure you have the latest qa branch in your local environment.
  3. Checkout the (temp) branch "qa-temp-merging-feat35" at the terminal
  4. Merge (dev) branch into the (temp) branch manually (terminal). This is where I consult another developer who worked on this portion of the file to resolve the conflict harmoniously 😆
  5. Commit and push to complete the merge.
  6. Create a new pull request from (temp) "qa-temp-merging-feat35" to (target) "QA" at Github.com, now the preview should not be showing any conflicts.
  7. Add two reviewers
  8. Once passed, complete the merge
  9. Congrats! You have successfully merged (dev.) "feat/35" into (target) "QA". (though indirectly)
  10. As per best practices, you should delete the temp branch you created in this process, so that the repo is clean.

What did you just do? (For those more "visual" youts)

  • Step 4: (dev) -> (temp)
  • Step 6: (temp) -> (target)
  • == (dev) -> (target)