Unable to revert pull request in Bitbucket Cloud
Summary
You may encounter the following error while performing a pull request revert.
Unable to revert pull request
The resulting revert would cause conflicts on one or more files. You will need to resolve these conflicts manually or create a new pull request to revert these changes.
Diagnosis
If the pull requests are merged with a "Fast Forward" or "Squash" strategy, you will end up with the error above. The pull request revert feature is not supported for these merge strategies. Please vote for the suggestion request below. It was created to support Revert for Pull Requests that were merged using Fast Forward and Squash Merge strategies.
Solution
As a workaround, you can revert locally using the `git revert <commit hash>` command or any other git client (sourcetree, Tortoise git, etc.) to revert.
For example: On the command line, this is:
git clone -b <merged_branch> <your_repo_url>
git checkout <revert_branch>
git pull
git log
Then, we revert the merge commit and push it:
git revert -m 1 <SHA-1>
git push
Or, In SourceTree, first checkout the branch in question, then Pull. Find the merge commit in the log window, right-click it, and click Copy SHA-1 to Clipboard... Then go to Actions --> Open in Terminal. Once the terminal opens, type:
git revert -m 1 <SHA-1 (from clipboard)>
git push
Note: Before you proceed, make sure your working copy is clean, with no uncommitted or unpushed changes.
If you are encountering issues following this documentation - please raise a support ticket or a community support ticket for further assistance.