Question

I accidentally made a wrong pull request and ended up closing the request myself. It's in a closed state right now but it's accessible via direct URL and showing on my activity bar.

Is there any way to delete a pull request completely so it's no longer accessible via URL or shows up on your activity history?

Was it helpful?

Solution

There is no way you can delete a pull request yourself -- you and the repo owner (and all users with push access to it) can close it, but it will remain in the log. This is part of the philosophy of not denying/hiding what happened during development.

However, if there are critical reasons for deleting it (this is mainly violation of Github Terms of Service), Github support staff will delete it for you.

Whether or not they are willing to delete your PR for you is something you can easily ask them, just drop them an email at support@github.com

UPDATE: Currently Github requires support requests to be created here: https://support.github.com/contact

OTHER TIPS

5 step to do what you want if you made the pull request from a forked repository:

  1. reopen the pull request
  2. checkout to the branch which you made the pull request
  3. reset commit to the last master commit(that means remove all you new code). Command: git reset --hard commit_hash_here
  4. git push --force
  5. delete your forked repository which made the pull request

And everything is done, good luck!

This is the reply I received from Github when I asked them to delete a pull request:

"Thanks for getting in touch! Pull requests can't be deleted through the UI at the moment and we'll only delete pull requests when they contain sensitive information like passwords or other credentials."

It's very easy actually:

You can empty it, that's the best you could do.

  1. Go to your local

  2. Copy your local branch unwanted-branch (against which the PR was opened) to a new branch new-branch. This copying is relevant if you want to back it up for any reason. Otherwise go to step 3.

    • $ git branch -b new-branch
    • $ git merge unwanted-branch
    • $ git push
  3. Empty the unwanted-branch

    • $ git checkout unwanted-branch
    • $ git reset --hard HEAD~n #n is the number of commit the branch has
    • $ git push -f

Enjoy, your PR is empty and closed now ;). Go to remote and delete the unwanted-branch if it bothers you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top