Delete a Pull Request

How can I delete a Pull Request from the system completely?

If I have to do this manually I'm OK with that. We do not use an external database.

7 answers

2 accepted

2 votes
Seb Ruiz Atlassian Team Oct 13, 2012

Pull requests cannot be deleted. You could tinker with the database but I would highly recommend against it (we could not provide you with adequate support if something goes wrong).

Why do you want to delete pull requests?

Pull request submitted for testing purposes will remain forever. Not a huge deal I suppose.

I, too, would really like to have the ability to delete declined pull requests. We work on a team of several developers, and our workflow is that pull requests in the Open tab are ready to be reviewed. If changes need to be made, the PR is declined and re-opened when changes are ready for review again. However, there are many times that for whatever reason a branch that was once reviewed gets abondoned. Now, that branch is permananatly sitting in the Declined box, so that box can no longer be treated as a list of open issues that still need work. It would be a huge help to be able to permanantly delete items from there.

"Why do you want to delete pull requests?"

Because it is referencing a ticket that is not related to the change. I, as a release Engineer, run into this issue often when developers commit work and push to the wrong branch and then reference another branch and ticket they thought they were working on. Since I can't delete the pull request, the reference stays and the tickets appear to be linked even though they aren't linked or related.

Here's another reason: The PR contained credentials. Not only do I want to be able to decline the PR, I want the history of the PR gone as well.

I don't want to misinform, but I believe you should be able to to remove the commit from any branches, decline the PR, and force a git gc to remove the data from BBS. The specifics on how to force the git gc might be more involved - for example you might need to be sure that the commit is no longer in the reflog (which is like Git's recent history of previous commits that a ref pointed to) before git gc will remove the commit. Don't take my word for it though - someone else might be able to comment more authoritatively, or you can probably get better help at support.atlassian.com. I don't want you to break your instance by following my instructions in production, so definitely test it out somewhere non-production and take a backup first (which you might later have to delete if you really want those credentials gone).

All that said - once credentials are compromised, you should definitely stop using them and change the password, regardless of whether you can successfully remove them from the repository. They've been leaked and aren't secure anymore. If you do this, it also makes their removal from the repo less important as well since the credentials are no longer valid. Of course if the leaked data is "names and addresses of all our customers" and not credentials, this suggestion doesn't help - can't change those.

Best of luck, Ryan. Don't hesitate to get help from support if you need it.

Adam

People have commented more authoritatively - check out the threads below. You cannot delete PRs even after they're declined.

2 votes

Starting with Bitbucket 5.1, which is available now, you can delete pull requests. 

Yay! Finally.

Can we not do this on bitbucket.org yet? I've got a list of declined PRs I'd love to delete.

 

All I have is the Approve button?

Delete the PR from where exactly? All I see is an approve or decline button

I think deleting a pull request is a valid use case. We had an issue where a developer accidently commited a file with sensitive information, and submitted a pull request where that information was visibile to all. It now lives on in a pull request, and we have no way of removing this.

Another vote for this.

What about pushing another commit on the concerned branch removing the file with sensitive information ?

override pull request to upstream by creating on it new commit(for example with --amend) and `git push -f`. It will decline pull request, at least I don't have any requests for it after this action.

6 votes

x2. I just created a pull request, and accidentally picked the wrong destination branch. I apparently can't edit the request to pick the right branch or delete the whole request. My mistaken request will exist forever as clutter.

In newer Stash versions you can change the destination branch if that helps. :)

It does help -- I was glad to see that added recently! That said, I'd still love to be able to permanently delete some declinced PRs. In our project with 12 devs, we're now up to about 100 declined PRs that will live in the declined box forever. A handful of those were from before you could change the destination branch after creating a PR, but most are ideas that were started and reviewed, but for one reason or another were declined/abandoned. Would be really nice to have the ability to let Declined tab function as a list of PRs that have not passed code review, but are still actively being worked on. It's easy for them to get lost in the noise as it is now.

While that helps, I already merged those changes into an alternate branch and now I cannot reset the branch to that branch. Deleting a pull request is a very important feature. People make mistakes, requirements change and others can come up with a much better approach.

Hi All, 


There is a Hot existing request on this which you can find it on STASH-3134. Please watch that ticket for the development progress of this feature.

 

Cheers, 

Andrew Er

If you click Decline, and you are the author, it will close the PR

Hi Tom, closing is not the issue. Declined pull requests remain in the system and can be found in the "Declined" group. Declined pull requests behave the same whether it was the author that declined them or not.

Suggest an answer

Log in or Join to answer

Stay in touch

Be the first to know what's trending on Atlassian Community