Reputation: 9331
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?
Upvotes: 424
Views: 389621
Reputation: 51935
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 [email protected]
UPDATE: Currently Github requires support requests to be created here: https://support.github.com/contact. The automated system will only allow deletion if you're an admin of the repository.
Upvotes: 435
Reputation: 5499
Github now uses a virtual assistant to delete the pull request for you. If you go to:
https://support.github.com/contact
You can tell the virtual assistant that you want to delete a pull request. It will ask you for the url of the pull request and a few other questions then notify you when
Upvotes: 12
Reputation: 78
Unlike other experiences I've seen on this post, asking GitHub to delete my Pull Request on a repository I do not control, I got this reply:
Hi (username),
No problem! I've gone ahead and deleted that pull request for you. I’ve also cleared the cache of your repository.
Of course, we still recommend changing any leaked sensitive data as soon as possible, if you haven't already.
Feel free to reach out again if you need anything else!
Cheers,
So, the support request did work. I had no personal data on the PR - I just asked for a deletion. I recommend giving it a try.
Upvotes: 4
Reputation: 958
You can empty it, that's the best you could do.
Go to your local
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
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.
Upvotes: -1
Reputation: 1759
5 step to do what you want if you made the pull request from a forked repository:
git reset --hard commit_hash_here
git push --force
And everything is done, good luck!
Upvotes: 49
Reputation: 491
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."
Upvotes: 38