Git makes branching easy, which lets your team efficiently tackle all kinds of problems in parallel. You can use the feature branch workflow to safely develop features in isolation from your master branch, or the git-flow workflow to manage support, hotfix, and release branches. However, Git’s flexibility also means it may be easier to make mistakes.

When switching between branches, a developer can easily delete a branch or push changes to the wrong branch, resulting in confusion and wasted time backing out the changes. To avoid this, many teams want to ensure all commits to the master branch go through pull requests, or that only the release manager has access to a deployment branch to prevent bugs. Some companies also use these practices as part of a compliance regime to adhere to SOX, SOC2, or other standards. Today, we are releasing updates to our branch-level access permissions for your projects in Bitbucket Cloud to help you address these development and compliance concerns.

Updates to branch permissions: flexible and powerful

Branch permissions let you lock down critical branches and customize exactly who has access to a branch. Most teams we’ve talked to tend to have one or two branches that need to be restricted, but they don’t want or need to apply the same restrictions to every branch in the repository. The updated branch permission UI makes it easy to:

Pick a specific branch to restrict, or set restrictions for all branches matching a pattern.

Limit write access to that branch to a set of users or groups.

Limit merging to that branch to a set of users or groups.

Prevent anyone from deleting or rebasing a branch, even if they have write access.

This means you can lock down your production branch, require everyone to use pull requests to merge to your master branch, and ensure you never lose critical code.