Hi,
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.
Thanks,
Moti.
Hi Moti,
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.
Best regards,
Thiago Bomfim
Atlassian Support - DevTools
Hi Thiago,
we have similar issue , I want to understand if the Master got deleted during the merge
then what would be the reason ? How can we work RCA to investigate the issue ?
Any suggestion ?
Thanks,
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Under branch permission you can add Permissions for certain branches and there you probably have your branches which also have limited access rights. When you edit your branch permission there is also the option to flag the branch with "Prevent branch deletion".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thiago,
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.
Thanks,
Moti.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Moti, I am facing the exact same issue. Did you get a resolution for the problem faced? If yes, can you share?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My point is if somebody has no write access to a branch (the source branch here), then they should not be able to delete that branch via any interface. If this is not so, report it as a bug here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But this is not my case. I want to restrict deletion of certain branches (at least from the merge pull request dialog), even if the user has write permissions to the branch.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That sounds like a feature request, you can also make it in the same place.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We have the same problem. We'd like protect branch (release-*, feature-*) from deletion after merge it into master
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would expect that if somebody has no write access to a branch, they also cannot delete the branch.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.