It is not possible to revert Pull Requests merged with fast-forward strategy

XMLWordPrintable

    • 5
    • Severity 3 - Minor
    • 220

      Issue Summary

      • As per the title, whenever a PR is merged using the fast-forward strategy, you get the following error message when trying to revert it:
        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.
        
      • On the console log, we get a 400 with the following response:
        {"type": "error", "error": {"message": "The merge commit doesn't have exactly two parent commits."}}
        

      Steps to Reproduce

      1. Create a branchB from branchA;
      2. Commit your changes to branchB;
      3. Open a pull request from branchB to branchA;
      4. Merge it using the fast-forward merging strategy;
      5. Try to revert the PR;

      Expected Results

      • The PR should be reverted;

      Actual Results

      • An error occurs and it is not possible to revert the PR;

      Workaround

      Even though it is not possible to revert the Pull Request through the Bitbucket UI, it is still possible to do so from the command line:

      1. Identify the last commit before branchB was created with
        $ git log
      2. Grab the commit SHA and run
        $ git revert <SHA>
      3. This might generate a few conflicts that will need to be resolved locally;
      4. Commit the changes and push to the remote;

            Assignee:
            Unassigned
            Reporter:
            Mateus T
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: