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

How to use branch permissions and working with hotfixes

Bert Oost November 27, 2017

Hi there,

We're using Bitbucket cloud and lately we have activated premium to use branch permissions. This works great, except when we create a hotfix branch, prefixed with "hotfix/" (eq. the git flow principles) and want to merge the hotfix back into master and develop. 

This is how we have branch permissions configured;

  • 2 usergroups:
    • 1 for all developers
    • 1 for admins only
  • Branch: develop
    • Write access: none
      • Deleting this branch not allowed
      • Rewriting branch history not allowed
    • Merge via PR: developers
      • Check for at least 2 approvals
      • Check for unresolved PR tasks
      • Approvals reset when source branch updated
      • Merging with unresolved checks is not allowed
  • Branch: master
    • Write access: none
      • Deleting this branch not allowed
      • Rewriting branch history not allowed
    • Merge via PR: administrators
      • Check for at least 1 approval
      • Check for unresolved PR tasks
      • Approvals reset when source branch updated

This normally is exactly what we want. Every developer can PR to develop, merge when they got enough approvals and they can create a PR to master (for production release request) but normal developers can't merge it since that's a "admin" only task.

So far so good.

In the case of an hotfix...

As developer I branch from master and create an branch like hotfix/incident-name and I fixed the hole. I commit and send a PR to get my review and approvals. Also don't check "close branch after merge" checkbox. Since the hotfix needs to be merged to develop too.

Any admin user should be triggered to merge the PR. Which is no problem. After that I want to merge to develop too. As admin I know that I have to merge a hotfix to develop too, but since I have configured branch permissions, I do need to wait for approvals again.

At the moment I temporarily remove the "merge checks" prevent option from the develop branch, and merge the hotfix instantly. But that can't be the solution I think.

Is there another way to get this done more easily?

Many thanks!

Regards, Bert

1 answer

0 votes
Alastair Wilkes
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 4, 2017

Hi Bert,

Thanks for your question.

At this time, I can't think of a way to do this more easily; you'll either need to get the approvals again (for the second PR) or temporarily disable the merge check. The branches have no way of 'knowing' their place in the hierarchy.

I'm sure it could get pretty complex pretty fast, but this is a neat problem to solve! Thanks for bringing it to our attention.

Alastair
Product Manager, Bitbucket Cloud

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events