mvallebr
mvallebr

Reputation: 2508

Is there an easy way of reverting an already merged Pull Request using the API?

github provides a "Revert" button in it's web interface, which allow us to revert a pull request that was already merged.

This always involves, to the best of my knowledge, creating a new pull request to revert the changes.

Is it possible to replicate this functionality easily using the API? Is it possible to do it without having to create a new Pull Request?

Just to clarify more, the PR is from branch A to branch B - If I undo the changes in branch B using underlying git commands, what will happen to the PR?

Upvotes: 3

Views: 1001

Answers (1)

Ian Stapleton Cordasco
Ian Stapleton Cordasco

Reputation: 28757

There's no API endpoint to do this for you, no. What you need to do is use the SHA of the merged pull request and do a git revert SHA locally followed by a git push to the appropriate branch. That avoid needing to do a new pull request.

If I undo the changes in B using the underlying git commands, what will happen to the PR?

Nothing. It remains merged.

Upvotes: 2

Related Questions