GitHub: Reopening a merged pull request

GithubMergePull Request

Github Problem Overview


  • I made some changes
  • I submitted a pull request
  • The pull request was accepted and merged.
  • We found a bug
  • The changes were removed again (force push to 1 commit before) whilst I fixed the bug.

I've now fixed the bug and want to resubmit the pull request with 1 extra commit. Is there any way to reopen the pull request or update it, or do I have to create a new pull request, type out the description etc again? Gitorious has this feature and we've recently moved to GitHub.

Github Solutions


Solution 1 - Github

The answer seems to be: You can't.

Once a pull request is merged and closed, it is locked forever and cannot be reopened. If your pull request is merged, closed, then your changes are pulled out (via force pushing backwards to before the merge), you will need to add commits to the branch and create a new pull request, copying all the details over and probably providing a link to the original pull request to manually save the history.

Might be a nice feature request for future GitHub.

Solution 2 - Github

I just successfully reopened a pull request by

  1. Commenting on the pull request
  2. Clicking the 'Submit and re-open' button which appeared on the comment form.

Solution 3 - Github

You can use the revert action:

enter image description here

It will create another pull request undoing all the changes did in the merged PR.

Solution 4 - Github

Just derive a new branch from the existing branch where you have done extra 1 commit. From there submit the pull request.

Solution 5 - Github

I managed to reopen it by:

  1. Restoring the base branch
  2. Reopen and Comment

Solution 6 - Github

You could just revert a reverted PR, this should have all the changes that was reverted from original PR.

Solution 7 - Github

I've tried all of the tricks & tips. Simply - you can't re-open it.

It is what it is. (even that I'm sad they haven't come up with this)

Solution 8 - Github

Well, it's 2021 and—almost a decade later—to my dismay, stupor, and joy, a simple gh pr reopen N¹ did reopen my PR—in a situation which I know was un-reopenable through UI before (or so I believe). ¯\_(ツ)_/¯

May this work for you too!

(¹) gh being GitHub’s official command line tool.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMichael ParkerView Question on Stackoverflow
Solution 1 - GithubMichael ParkerView Answer on Stackoverflow
Solution 2 - GithubTim Lovell-SmithView Answer on Stackoverflow
Solution 3 - GithubWilliam WecklView Answer on Stackoverflow
Solution 4 - GithubSiva GollapalliView Answer on Stackoverflow
Solution 5 - GithubseebiView Answer on Stackoverflow
Solution 6 - GithubVladaView Answer on Stackoverflow
Solution 7 - GithubMatěj HusákView Answer on Stackoverflow
Solution 8 - GithubDatoView Answer on Stackoverflow