This topic describes how to configure and use repository specifications. You can use repository specifications to enforce branch naming rules and merge direction rules for a repository. This ensures that all created branches and merge requests comply with your organization's governance requirements.
Availability: This feature is exclusive to the Advanced edition. For more information about editions, see Editions.
Configuration
A repository administrator can configure repository specifications as follows:
Go to the repository settings and select repository specification (this feature requires the Advanced edition).
Click Enable repository specification.
Select a repository specification plan. You can choose a custom plan or use a system plan.
If you select a custom plan, you can create your own branch specification. You must specify the branch type, naming rule, roles allowed to create branches, and a description. You can also customize the merge direction rule to set rules for source and target branch types.
If you select a system plan, you can choose from built-in strategies, including the GitLab branching strategy, Gitflow branching strategy, feature branching strategy, or single-branch strategy.
The settings take effect immediately.
Usage
When a repository administrator configures repository specifications, the system validates new branches and merge requests against the rules. The system rejects branches and merge requests that do not comply.
New branch validation
When you create a new branch, the system validates its name against the repository specifications.
Existing branches that do not comply with the specifications are flagged with a notification.
New merge request validation
When you create a new merge request, the system validates it against the repository specifications.
Merge requests created before specifications were configured are not subject to these rules and can still be merged.