Branch and Tag Naming Standards Enforcement

This allows you to enforce a naming standard for branches and tags using regular expressions.

You may want different naming standards for different types of branches. For example for your feature and bugfix branches, you may want them to contain a Jira issue ID. For hotfix branches you may require that they begin with a Change Request ID. Therefore you can specify multiple regular expressions for both branches and tags. If none of them match, the supplied error message (or a default one), will be returned to the user.

An example where feature branches must start with a Jira issue key, hotfix branches must begin with a CR number:


feature/[A-Z]{2,9}-\d+.*
hotfix/CR-\d{3,}.*

To enforce tag names follow the format: 3.2.14:


\d+\.\d+\.\d+

Include Prefix Regex Checking

The Branch and Tag Naming Standards Enforcement pre hook removes any prefixes of the form refs/$something/ from ref names before checking them against the user-supplied regex. By setting this parameter, the ref name will keep its prefix refs/$something/ before doing the regex checking.

When a branch is created through the UI that doesn’t conform to the rules, it will be blocked like this:

Any custom message added for enforcing tag names will not be displayed in the UI due to the way Bitbucket handles certain cancellable events.

On this page