How to Cancel a Git Pull Request

  • Last updated Apr 25, 2024

Sometimes, after creating a pull request, you might remember something and want to cancel it before it gets merged.

Follow these steps to cancel a Git pull request:

  1. Go to the pull request you want to cancel on the remote Git repository's page.
  2. On the Git pull request's page, you should see a 'Close Pull Request' button. Please click on it.
  3. If you see the confirmation message for closing the Git pull request, go ahead and confirm your choice.
  4. You might be prompted to leave a comment explaining why you're closing the pull request. This step is optional but can provide context to others.
  5. Once you confirm, the pull request will be closed. It won't be merged, and its status will change to 'Closed'.

Remember that closing a pull request doesn't delete it; it simply marks it as closed. If you need to make further changes or decide to reopen the request, you can do so. To get rid of it, you can simply delete the branch from the remote repository by running the following command:

git push origin --delete branch_name

Replace 'branch_name' with the name of the branch you want to cancel and delete from Git pull request. Follow these steps to cancel a Git pull request: