DevOps / Github Interview questions
How do you troubleshoot merge conflicts flagged in a GitHub pull request?
GitHub flags a pull request as having conflicts when the source and target branches have both changed the same lines (or GitHub can't auto-merge them cleanly) since the branch diverged. The PR page shows a "This branch has conflicts" warning and, for simple text conflicts, offers a "Resolve conflicts" button right in the browser.
- Try the in-browser resolver - for straightforward conflicts, GitHub shows the conflicting sections with conflict markers and lets you edit the merged result directly in an editable box, then commits the resolution to the source branch.
- Fall back to the command line for complex conflicts - pull the latest target branch locally, merge or rebase it into the feature branch (
git merge origin/mainorgit rebase origin/main), resolve conflict markers in your editor, and push the resolved branch back. - Re-run required checks - resolving conflicts doesn't guarantee the combined code still works, so the PR's required status checks should re-run and pass before merging.
- Re-request review if the resolution was non-trivial - if resolving the conflict meant making a real code decision rather than just picking one side, it's worth asking a reviewer to look again.
The in-browser resolver only handles conflicts GitHub considers simple text conflicts; anything involving renamed files, binary files, or overlapping logic changes generally has to be resolved locally where you have full editor tooling and can actually run the code.
More Related questions...