Stash has the option to delete the source branch when merging a pull request.
Is there a way to limit this? I would expect that this is configurable so that this check box will be disabled for certain branches, or that branch permissions will include 'delete' in addition to 'read' and 'write'.
We experienced a human error of accidentally deleting a branch (not feature) in this way, and we want to prevent this somehow.
What you are asking is already implemented. From the Merging a Pull Request document:
In the 'Merge Pull Request' dialog, you can check Delete branch if you no longer need that branch in the repository. Stash checks on a few things before allowing the deletion – the branch being merged will not be deleted if:
In regards to the point "The user does not have permission to delete the branch.", user in this context means the "user merging the Pull Request". Make sure you go through the Using branch permissions document. Once you set this up, you will be able to prevent unauthorised users merging the pull request from deleting the branch.
Another important point to observe here: if you are not sure that this branch should be at all deleted, why check the box during the PR creation in the first place? Stash offers ways of stopping the Pull Request from being accidentally merged. Stash implements Checks for merging for Pull Requests. Or you can write your own plugin and/or download a plugin like the Stash auto unapprove plugin.
Let me know if this was helpful.
Atlassian Support - DevTools
Thanks for your answer.
Unfortunately, this does not solve my use case.
Let's say we are following the gitflow branching model.
There is no 'delete' permission - only read or write. Also, there is no way to disable the check-box via configuration for certain branches. Accidental merging is not something i'm concerned about at the moment.
I was hoping maybe there is a way to prevent this, but it seems like there isn't.
Announced in this blog, this holiday season we’re celebrating all things CI/CD and between now and the end of 2019 we’ll be showcasing content, use cases, feature announcements and more. One featur...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events