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.
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 themaster
anddevelop
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:
Branch | Introduce changes | Delete branch | Rewrite history | Push and merge directly |
---|---|---|---|---|
master | Everyone | Nobody | – Guidewire
| – Guidewire
|
develop | Everyone | Nobody | – Guidewire
| – Guidewire
|
gw-releases | Guidewire | Nobody | Everyone | Everyone |
hotfix-* | – Guidewire
| Everyone | Everyone | Everyone |
Custom branches | Everyone | Everyone | Everyone | Everyone |
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.
Example
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:
-
Select a star system.
-
From
Apps, select Repository Settings or select it from your pinned apps.
-
Select the Branch restrictions tab.
You can also manage branch restrictions with the Repository Settings API.
Add a restriction
To add a branch restriction:
-
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.
-
From the Repository dropdown, select a repository.
-
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.
-
-
Select at least one branch restriction.
-
(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.
-
Select Add.
Edit a restriction
To edit a branch restriction:
-
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.
-
Select
Edit next to an element that you want to modify.
Delete a restriction
To delete a branch restriction:
-
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.
-
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.