How to use branch permissions and working with hotfixes

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

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
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

422 views 5 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you