Skip to main content

Branch restrictions

With branch restrictions, you can control who can perform the following actions:

  • Introduce changes to a branch.

    A user with this permission can create a branch and commit changes to it.

  • Delete a branch.

    A user with this permission can delete only certain branches.

  • Rewrite a branch history.

    A user with this permission can rebase a branch, force push changes, or squash commits.

  • Push and merge directly into a branch.

    A user with this permission can commit changes directly without the need of creating a pull request.

You can configure branch restrictions on a repository level. You can also define users or user groups to whom the selected restriction doesn't apply.

Note:

Access to this feature is limited to users who already have access to CI Manager.

Prerequisites

The following limitations apply:

  • You can't modify the Delete branch restriction for the master and develop branches.

  • You can't modify any restrictions for any branch whose name starts with gw-.

  • You can't modify restrictions configured on a star system level.

    These restrictions are marked as set in Project.

  • Branch restrictions don't apply to Guidewire.

Supported roles

Guidewire supports the following roles for performing tasks related to source code:

  • Admin
  • Developer
  • Guidewire

For details, see Roles and permissions.

Default configuration

The following branch restrictions are configured by default:

BranchIntroduce changesDelete branchRewrite historyPush and merge directly
masterEveryoneNobody

– Guidewire
– Admin

– Guidewire
– Admin

developEveryoneNobody

– Guidewire
– Admin

– Guidewire
– Admin

gw-releasesGuidewireNobodyEveryoneEveryone
hotfix-*

– Guidewire
– Admin

EveryoneEveryoneEveryone
Custom branchesEveryoneEveryoneEveryoneEveryone

Note that your individual configuration might differ from the default one.

Priority of restrictions

If there are multiple restrictions that apply to the same branch, the exceptions to these restrictions have the highest priority.

You configure the following restrictions:

  • Nobody can delete a branch named user/john/new-feature.
  • Nobody can delete branches that match the user/john/ pattern, except for user John Doe.
  • Nobody can delete branches that match the new-* pattern, except for a given user group.

As a result, John Doe and all users that belong to a given user group can delete the user/john/new-feature branch.

Manage branch restrictions

To manage branch restrictions:

  1. Select a star system.

  2. From Apps, select Repository Settings or select it from your pinned apps.

  3. Select the Branch restrictions tab.

You can also manage branch restrictions with the Repository Settings API.

Add a restriction

To add a branch restriction:

  1. In the Branch restrictions tab, select + Add restrictions.

    You can also select + Add restrictions next to the repository whose settings you want to change. Then in the dropdown, you can see the pre-selected repository.

  2. From the Repository dropdown, select a repository.

  3. Specify the branch. You have the following options:

    • Branch name

      Applies only to a branch with the specified name. The branch must be active.

    • Branch pattern

      Applies to every branch whose name matches the pattern. For details, see Branch patterns.

  4. Select at least one branch restriction.

  5. (Optional) Specify users or user groups to whom the restriction doesn't apply.

    Users must have a Bitbucket account and access rights to the star system that includes the selected repository.

  6. Select Add.

Edit a restriction

To edit a branch restriction:

  1. In the Branch restrictions tab, expand the configuration for a selected repository.

    For Jutro apps and Integration apps, select a repository from a drop-down list.

  2. Select Edit next to an element that you want to modify.

Delete a restriction

To delete a branch restriction:

  1. In the Branch restrictions tab, expand the configuration for a selected repository.

    For Jutro apps and Integration apps, select a repository from a drop-down list.

  2. Select Delete next to an element that you want to delete.

    The deleted element is now crossed out.

Troubleshooting

Here are the most common issues related to branch restrictions:

  • A user doesn't show in the drop-down lists.

    Verify if the user has a Bitbucket account and access rights to the star system. If they do and you still can't see them, it might be a propagation issue. To fix it, the user must first log in to Bitbucket.

  • The Edit button is disabled when editing branch restrictions and I can't save my changes.

    Remove all inactive and deleted users from your configuration.