Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to delete a pull request via the api?

John Payne
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2019

I see the option to delete individual pull requests in Bitbucket server, but need a way to delete unmerged PRs in bulk that are of a certain age.

1 answer

1 accepted

0 votes
Answer accepted
Julius Davies [bit-booster.com]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2019

 

Yes.  Use HTTP DELETE.  More info here:

https://docs.atlassian.com/bitbucket-server/rest/5.1.0/bitbucket-rest.html

Requires at least Bitbucket Server 5.1.0.

Alternatively, if you're willing to toast all the source-branches (via "git push --delete") that correspond to your stale PR's, that will automatically close the PR's, and is easy (though somewhat dangerous) to do in bulk.  More info here:

https://community.atlassian.com/t5/Bitbucket-questions/Is-there-a-way-to-delete-branches-in-bulk/qaq-p/547331

 

John Payne
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 22, 2019

ahhhh. only on 5.1.0 then. Good to know when we upgrade. Thanks!

Julius Davies [bit-booster.com]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2019

Unfortunately the only way to figure out what versions of the REST API support various features is via binary-search (by altering the Bitbucket version directly in the URL)!

e.g., I tried 5.0.2:

NOPE - https://docs.atlassian.com/bitbucket-server/rest/5.0.2/bitbucket-rest.html

Then 6.0.0:

YUP - https://docs.atlassian.com/bitbucket-server/rest/6.0.0/bitbucket-rest.html

And so on until I found the feature appeared in Bitbucket 5.1.0.

 

p.s.  You might like our PR-Booster add-on!  It works all the way back to Bitbucket 4.x and provides a pretty substantial bump in functionality (e.g., rebase, squash, amend, and cherry-pick buttons, among other things).  Bitbucket's built-in rebase functionality doesn't appear until Bitbucket 5.5.x.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events