Bitbucket pull request merge conflicts
When the source branch and the destination branch of a pull request change the same lines differently, or one changes a file the other deletes, Bitbucket cannot merge the pull request until the conflict is resolved, and Bitbucket's web page has no editor for it: the resolution is made in a clone of the repository and pushed. Below is what Bitbucket shows and what to do, from Atlassian's Resolve merge conflicts (Cloud), Merge a pull request (Data Center 10.5) and the REST references.
What Bitbucket shows
- Bitbucket Cloud: while there are conflicts, the pull request's Merge button cannot be selected, and Bitbucket tells you about the conflicts when you try to merge.
- Bitbucket Data Center: a conflict that prevents the merge is shown on the pull request's Overview and Diff tabs, and More information gives instructions for resolving it in your local repository. The Merge button is enabled as soon as the pull request is created unless there are merge conflicts.
- Auto-merge (Data Center) needs a pull request without merge conflicts, and Bitbucket cancels auto-merge when the pull request gets them.
Resolving them on your machine
Atlassian's steps for Bitbucket Cloud, with the source branch feature and the destination main in the same repository:
git checkout feature
git pull origin main
# Git merges main into feature and stops at the conflicts
# edit each conflicting file: remove the markers, keep the right content
git add <file>
git commit -m "Merge main into feature"
git push origin feature
- After the push, the pull request is still open and no longer shows the conflicts.
- In a conflicting file, the text between
<<<<<<<and=======is your branch's and the text between=======and>>>>>>>is the merged-in branch's. - From a fork: Atlassian's page pulls the original repository's branch into the fork's branch the same way. It also warns that resolving the conflict in the original repository instead merges the pull request when you push.
- Rebasing
featureontomainresolves them too, but rewrites the branch's commits, so the push has to replace them (git push --force-with-lease), which a branch restriction may forbid.
From the REST API
- Bitbucket Cloud,
GET …/pullrequests/{id}/mergeability/checks: thegit_mergeability_checkhas areasonofclean,conflictsormerge_impossible, left out when its status isUNKNOWN(which, Atlassian notes, does not mean the pull request is free of conflicts). When it blocks, itslinks.detailspoints to the pull request's conflicts endpoint. - The conflicting files (Cloud):
GET …/pullrequests/{id}/conflictsredirects to…/file-conflicts/{spec}, a list ofpath,scenarioandmessage, for examplecontentwith "File modified in both source and destination", ordelete_modify,binary,rename_delete,directory_file. - The old way, a diff or diffstat with
?merge=true, is gone: the Bitbucket Cloud changelog of August 24, 2026 says the parameter, deprecated since 2022, is removed as of September 4, 2026. - Bitbucket Data Center,
GET /rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge("Test if pull request can be merged"):conflicted(true or false),outcome(CLEAN,CONFLICTEDorUNKNOWN) and thevetoesof the merge checks.
Merge conflicts in IntelliJ IDEA
Pull Request Inbox for Bitbucket, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, lists the pull requests that wait for your review in an IDE tool window, from Bitbucket Cloud and, in beta, from Bitbucket Data Center 8.9 or later. From version 1.0.42, a pull request with merge conflicts says so at the top of its Overview, with Resolve in the IDE: it fetches, checks out the source branch and merges the destination branch into it, so the conflicting files open in the IDE's merge dialog (Accept Yours, Accept Theirs, or Merge… side by side). From 1.0.43 the Overview also lists the files in conflict and what clashes in each, read from the conflicts endpoint above on Cloud and from the conflict marks of the pull request's changes on Data Center. Commit the merge and push the branch, and the pull request can be merged. Resolving conflicts is free, as are the review inbox, diffs, discussions and merge checks; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).
Get it on JetBrains Marketplace
Bitbucket and Atlassian are trademarks of Atlassian; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by Atlassian or JetBrains.
More: Bitbucket merge checks · Bitbucket merge strategies · Bitbucket auto-merge · Bitbucket pull request plugins for IntelliJ IDEA, compared · 日本語