Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-21943

Enforce branch naming conventions

XMLWordPrintable

    • 3
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Hey team,

      We have had a user reach out requesting that there be a feature that will allow them to enforce a branch naming policy - this way they prevent users from pushing new branch names which do not conform to their specifications.
      Here is an excerpt of their testing/use case:

      My case is simple I would like to enforce a branch naming policy for my Repository. In more detail, my goal is to have only the branch following names and avoid (reject) all other branches which not follow my convention. The branches should follow the convention:

      feature-xxxx
      bug-xxxx-xxxx
      legacy-fix-xxxx
      performance-fix-xxxx
      technical-depth-fix-xxx

      So If an unexpired use tries to push the branch without the previous pattern matching the push branch should be rejected

      For simplicity let's assume we should follow only the convention `feature-xxxx`. My first thought was to set a pattern for the branch permission session, so I try to set the following patter

      • !(feature-*)

      With Write access NONE and Merge via pull request NONE too. But it didn't work. :|

      Then I try to have separate the rules

      Rule1

      pattern *

      Write access none

      Merge via pull request none

      Rule2

      pattern ^feature-*

      Write access anybody

      Merge via pull request anybody

      Thankyou,
      Ben

              Unassigned Unassigned
              57b7f67f3625 Ben
              Votes:
              138 Vote for this issue
              Watchers:
              68 Start watching this issue

                Created:
                Updated: