Use branch policies to set the conditions for creating branches and submitting commits.
Note: This functionality is available only with the PulseUno Git server.
Branch policies overview
Branch policies protect Git branches from unwanted actions, such as force pushing commits or deleting a branch.
As an administrator or Git repository owner, you can define a branch policy for a specific branch or a set of branches.
Use branch policies to control the following actions:
Force pushing to a branch.
Creating a branch with the same name.
Deleting a branch.
Requesting a ticket (request identifier) for a commit or branch.
Requiring verified signatures for commits.
Allowing commits only from specified emails.
You can create multiple branch policies.
Branch policies set for a specific branch are applied first. Branch policies that use wildcards to match multiple branches are applied in the order they are arranged. The top wildcarded policy takes precedence over those under it.
Drag and drop branch policies to change their order.
Create a branch policy
You can create a branch policy from scratch, or base it on an existing branch policy.
To create a branch policy:
In PulseUno, navigate to Spaces, select a space and then a Git repository.
In the sidebar, select Settings > Branch Policies.
On the Branch Policies page, click Add .
Tip: To create a branch policy based on an existing one, select the policy and click Duplicate . Then click the duplicated policy to open it for editing.
On the New Branch Policy page, specify the following details:
Field Description Branch name pattern Enter a branch name or a name pattern. Use an asterisk (*) as a wildcard to match a set of branches to which this policy will apply. Note (Optional) Enter additional information about the branch policy. Commits
Set restrictions for commits:
Require the commit message or branch name to contain a valid request identifier, except for Owners (set by default). Allows commits only if the commit or branch is associated with a valid ticket, such as a Jira issue, ALM Octane work item, or Dimensions CM request.
All commits must have verified signatures, except for Owners (set by default). Allows commits only if they are signed with a verified GPG key. For details about commit signing, see Add GPG keys to verify signed commits.
Prevent pushes, except for Owners (set by default). Restricts users from pushing changes. May be useful for historical branches or a mainline branch with server-side merges of pull requests.
Require committer emails to match patterns. Select this option to accept commits only from those users whose emails match the specified pattern. Then enter a list of email patterns separated by commas, for example:
By default, commit restrictions do not apply to repository owners. To extend the restrictions to owners, select Apply to Owners as well for the relevant option.
Define the following options:
Enforce linear history by preventing merge commits from being pushed (set by default).
Select Apply to Owners as well to enforce this option on all users, including owners.
Permit force pushes for all users with push access.
Set protections for creating and deleting branches:
- Prevent any user from creating matching branches.
- Allow any user to delete matching branches.
Note: Defining a branch policy that enforces signed commits in a branch may prevent server-side merges of pull requests to that branch. This behavior is expected, as the server-side merge doesn't have access to your private GPG key to sign commits on your behalf. To work around the issue, merge locally with a signature and push.