Maintain code quality at scale with project-level branch restrictions

We're excited to announce the launch of project-level branch restrictions. This feature is part of our efforts to help teams manage code at scale.

What are branch restrictions and merge settings?

Branch restrictions are an essential tool for maintaining the integrity of your codebase. They help you control access to specific branches so only authorized team members can push or merge.

Merge settings are used to maintain code quality. They are a list of conditions, such as approval requirements, successful build status and resolved tasks, that must be met before a pull request can be merged. Branch restrictions ensure that your team follows best practices and maintains code quality when merging changes.

The power of configuring branch restrictions within a project

Previously, branch restrictions have to be configured individually for each repository. While this provided flexibility, it also meant that maintaining consistency across repositories could become time-consuming and prone to errors. With the introduction of project-level branch permissions and merge settings, you can now apply a standard set of rules and checks to all repositories within a project, making it easier to manage permissions and maintain a consistent workflow.
Here are some key advantages of configuring branch restrictions within a project:

  1. Streamlined administration: Setting up and managing restrictions and checks for multiple repositories is now more efficient. With project-level configuration, you can establish a consistent set of rules that will save time and reduce the risk of misconfigurations.
  2. Improved collaboration: By applying the same set of branch restrictions across all repositories, team members can collaborate more efficiently, knowing that they're all following the same processes and best practices.
  3. Enhanced security: Project-level branch restrictions provide better control over access to your codebase. By assigning permissions at the project level, you can ensure that only authorized team members can push or merge changes, reducing the risk of unauthorized access or unwanted changes.
  4. Easier onboarding: When bringing new team members on board, it's much simpler to explain and enforce a single set of rules that apply to all repositories within a project. This makes it easier for new members to understand the workflow and adhere to the team's best practices.
  5. Simplified Auditing: Having a consistent set of branch restrictions across all repositories makes it easier to audit and review your team's workflow. This helps ensure that your team is following best practices and maintaining code quality.


Getting started with project-level branch restrictions

To start using project-level branch restrictions in Bitbucket, follow these simple steps:

  1. Navigate to the project in which you would like to apply branch restrictions.
  2. Select Project settings from the left navigation sidebar.
  3. Select Branch restrictions under the Workflow heading in the left navigation sidebar.
  4. Select Add a branch restriction.
  5. Configure your desired branch permissions and merge settings, then select Save to apply them to all the repositories in the project.

Once configured, the project-level settings will automatically apply to all existing and future repositories within the project. Keep in mind that repository-level settings will override project-level settings, so you can still have unique configurations for specific repositories, if necessary.