JR DevTools

How to resolve merge conflicts in an Azure DevOps pull request

Your pull request says “Merge conflicts. Next steps: Manually resolve these conflicts and push new changes to the source branch.” Azure DevOps has no built-in conflict editor, so you have two options: resolve locally with Git, or resolve in the browser with an extension.

Why the conflict happens

Azure DevOps tries a test merge of your source branch into the target branch (for example main). When both branches changed the same lines of a file, or one deleted a file the other changed, Git can't decide which version wins. The pull request can't be completed until the conflict is resolved in the source branch.

Option 1: resolve locally with Git

This works everywhere and needs nothing but Git and an editor. Replace feature/my-branch and main with your source and target branch.

git fetch origin
git checkout feature/my-branch
git pull
git merge origin/main
# Git lists the conflicted files. Open each one, resolve the
# <<<<<<< / ======= / >>>>>>> blocks, then:
git add .
git commit
git push

After the push, the pull request updates and the conflict is gone. A few tips:

Option 2: resolve in the browser

Cloning a large repository just to fix two lines is slow, and not everyone who reviews or completes pull requests has the repository locally. An extension can add a conflict editor to the pull request page.

Microsoft's DevLabs Pull Request Merge Conflict Extension used to be the usual choice, but it hasn't been updated since November 2023 and Microsoft says there are no development resources for it. See alternatives to the DevLabs extension.

Merge Conflict Resolver (made by us) adds a Resolve conflicts tab to every pull request:

  1. Open the pull request and select the Resolve conflicts tab.
  2. Pick a file. Target, source and result are shown side by side; non-conflicting changes are already merged.
  3. Above each conflict, choose Accept target, Accept source or Accept both, or edit the result freely.
  4. Select Mark as resolved. When the last file is done, Azure DevOps creates the merge with your resolutions.
  5. Optional (Pro): Commit the resolution to the source branch, so reviewers, builds and branch policies see exactly what will be merged.

3-way merge editor in the Resolve conflicts tab of an Azure DevOps pull request

Your edits are saved as a draft in the browser, so a reload doesn't lose work, and encodings and line endings are written back exactly as they were. There's a free plan and a 14-day Pro trial.

Which option should I pick?

SituationBest option
Complex conflict that needs building or running tests before you pushLocally
A few conflicting lines, or you don't have the repository clonedIn the browser
Someone else's pull request that you're reviewing or completingIn the browser
Hundreds of conflicts where one side should simply winEither: git checkout --theirs / --ours locally, or bulk resolve in the browser
Questions? Email support@jr-devtools.com.