Skip to content

Enforcing Branch Naming Conventions

Consistent branch names clarify purpose and automate workflows. GitLab push rules let you reject branches that do not match a regular expression.

  1. Go to your project and open Settings > Repository.
  2. Expand Push Rules.
  3. In Branch name pattern, enter a regex such as:
    ^(feature|bugfix|hotfix)\/.*
  4. Click Save changes.
  • ^feature\/ โ€“ require branches to start with feature/.
  • ^(bugfix|hotfix)\/JIRA-\d+ โ€“ include a ticket ID.
  • Document branch patterns in CONTRIBUTING.md.
  • Apply rules at the group level for consistent enforcement across projects.
  • Combine with protected branches to guard main lines of development.