Revert a merged pull request on Bitbucket

Unfortunately, there is no “Revert Pull Request” feature on Bitbucket as of this writing, but a feature request exists for it.

Note: Before you proceed, make sure your working copy is clean, with no uncommitted or unpushed changes.

So, you’ll have to revert the merge in Git. First, find the SHA hash of the merge commit.

On the command line, this is:

git checkout <branch>
git pull
git log

Then, we revert the merge commit and push it:

git revert -m 1 <SHA-1>
git push

In SourceTree, first checkout the branch in question, then Pull. Find the merge commit in the log window, then 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

Unfortunately, SourceTree doesn’t have a way to simply right-click and revert a merge, but a feature request exists for it.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)