How To Exclude Specific Branches Using Bitbucket Branch Permissions

Controlling who can create or modify branches in a repository is a critical part of maintaining code quality and workflow discipline — especially in large teams or regulated environments.

Bitbucket Cloud provides a powerful mechanism for managing this via Branch Permissions. But what if you want to allow a pattern, like release/*, but exclude a specific branch, say release/1.3.0?

Let’s explore how Bitbucket lets you do just that.


🧪 Example Use Case

Let’s say your team wants to only allow branches that follow these patterns:

Here’s how you can implement this:


⚙️ Step-by-Step Branch Permission Setup


🚫 How to Exclude a Specific Branch

This is where Bitbucket gets smart.

You can exclude a specific branch from a pattern using this syntax:

release*|!release/1.3.0

This tells Bitbucket:

Match all branches starting with release, except release/1.3.0.

So your permission rule would apply to:

This is extremely useful for cases where a particular release branch needs to be frozen or handled by a separate process.


⚠️ Watch Out for Permission Overlap

If you define both specific and wildcard rules (e.g., one for main, one for *), Bitbucket evaluates both. In such cases:

Here’s an example:

Wildcard (*)

Specific (main)

Result

No users

Allu

✅ Only Allu has access

Everybody

Allu

✅ Only Allu has access

Allu

Arjun

✅ Both Allu and Arjun have access


🧠 Final Thoughts

Branch permissions in Bitbucket are essential for managing team workflows, and the ability to exclude specific branches using the ! operator gives you precise control.

Use patterns like:

release*|!release/1.3.0

…to enforce nuanced rules — such as protecting a hotfix or production branch from unintended changes — while still allowing flexible development around it.