Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can you delete a branch with uncommitted pull requests?

Jean Hilaire
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!
March 1, 2023

i have some old branches in my team's repository that i'm finally cleaning up, however, some of these branches and commits that haven't been merged into the master branch yet.  these are so old that i just want to delete them with no merge.  is this possible?

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 2, 2023

Hello @Jean Hilaire ,

Welcome to Atlassian Community!

You can definitely delete branches in the UI by accessing the Branches option in the left panel, clicking on the three-dot icon (Action column) in the line of the branch you want to delete, and selecting Delete.

However, if the branch to be deleted is the source or destination branch of an Open pull request, the Delete option will be greyed-out and you will not be able to delete it while the Pull Request is still in the Open state.

The workaround in this case, as you don't want to merge those old Pull requests anymore, is to access the Pull Request page and filter for any PRs where the branch you want to delete is either the source or destination branch. Then you can open each of the PRs, click on the three-dot icon and select Decline. This will close the Pull request with the state Declined. Once all the open PRs of a given branch are declined, you should be able to delete that branch in the UI as usual.

Hope that helps! Let me know in case you have any questions.

Thank you, @Jean Hilaire 

Patrik S

Jean Hilaire
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!
March 6, 2023

Thank you!  The workaround has worked in some way.  We've had to create a new branch, committing the code and pushing this out to the new branch and then ultimately delete the old branch. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events