top of page
GeekGuy

How to revert Pull Request in Github

Updated: Jun 23, 2023

TL;DR:

A GraphQL mutation is now available for reverting a merged pull request: revertPullRequest.

revertPullRequest

Create a pull request that reverts the changes from a merged pull request.

Input fields

Return fields

Name

Description

clientMutationId (String)

A unique identifier for the client performing the mutation.

pullRequest (PullRequest)

The pull request that was reverted.

revertPullRequest (PullRequest)

The new pull request that reverts the input pull request.

RevertPullRequestInput

Autogenerated input type of RevertPullRequest.

Input fields

Name

Description

body (String)

The description of the revert pull request.

clientMutationId (String)

A unique identifier for the client performing the mutation.

draft (Boolean)

Indicates whether the revert pull request should be a draft.

pullRequestId (ID!)

The ID of the pull request to revert.

title (String)

​The title of the revert pull request.

Like the revert action on the pull request page in the web, calling this API creates a new pull request that reverses the changes made by the merged pull request.

Revert Pull Request in the web

You can revert a pull request after it's been merged to the upstream branch.

About reverting a pull request

Reverting a pull request on GitHub creates a new pull request that contains one revert of the merge commit from the original merged pull request. To revert pull requests, you must have write permissions in the repository.

Reverting a pull request

Note: You may need to revert the individual commits in your pull request if either of the following is true.

  • Reverting the pull request causes merge conflicts

  • The original pull request was not originally merged on GitHub. For example, someone could have merged the pull request using a fast-forward merge on the command line.

For more information about using Git to manually revert individual commits, see Git revert in the Git documentation

  • Under your repository name, click Pull requests.

how to revert pull request in Github - How to revert Pull Request in Github
  • In the "Pull Requests" list, click the pull request you'd like to revert.

  • Near the bottom of the pull request, click Revert. If the Revert option isn't displayed, you'll need to ask the repository administrator for write permissions.

how to revert pull request in Github

699 views0 comments

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
Stationary photo

Be the first to know

Subscribe to our newsletter to receive news and updates.

Thanks for submitting!

Follow us
bottom of page