Vetrix Docs

Branch protection

Branch protection rules guard the important branches in a repository, enforcing best practices before code is merged. Each rule matches one or more branches by pattern and can require a number of approvals, gate merges on a passing pipeline, and restrict who may push directly. The page lists every rule you have created, lets you add, edit, and delete rules, and shows a read-only list of all branches in the repository so you can see which are protected.

Where to find it

Branch protection is a repository setting.

  • URL: gitvetrix.com/<owner>/<repo>/settings/branches
  • From the repository: open the repository's Settings, then choose Branch Protection in the settings sidebar.

Managing branch protection requires owner or administrator access to the repository. Without it, the page shows the message "You do not have permission to manage branch protection rules."

Read the rules list

  1. Open the branch protection page. The heading Branch protection sits at the top, above the note "Rules that enforce best practices before code is merged into a branch."
  2. Read each rule in the list. A rule row shows:
    • the branch pattern, such as main or release/*;
    • a count reading <n> reviews required;
    • a push restricted or push open badge;
    • a pipeline gate badge when a pipeline is required (with pipeline gate (previous) when the predecessor branch's pipeline gates the merge);
    • a dismisses stale reviews (display only) badge, and any Status checks (display only) badges, when those extras are set.
  3. If the repository has no rules yet, the page shows No branch protection rules with the note "Add a rule to require reviews, status checks, or restrict direct pushes."

Some controls are marked display only in both the list and the form. Display-only settings are recorded and shown, but they are not enforced when a merge, push, or merge request is opened. The enforced controls are the required approvals, the pipeline gate, and the push restriction toggle.

Add a rule

  1. Select Add rule. A New rule form opens above the list.
  2. In Branch pattern, type the branch or pattern to protect. Use * to match any branch name or ** for recursive matching, as the field's hint describes. A pattern is required.
  3. Set the review, pipeline, and push options described in the sections below.
  4. Select Save rule to create the rule, or Cancel to discard the form.

The new rule appears in the list and a Branch protection rule added confirmation is shown.

Set review requirements

Within the rule form, the Review requirements group controls approvals.

  1. Use the Required approvals stepper to set how many approvals a merge needs. Select the minus and plus buttons, or type a number. Setting it to 0 means approvals are not required.
  2. Optionally, select Dismiss stale reviews when new commits are pushed. This option is display only and is not enforced at merge time.

Require status checks

The Required status checks (display only) group records status-check names for reference. It is display only and is not enforced at merge time; use the pipeline gate to actually block merges on a failing pipeline.

  1. Type a check name in the Add a status check field and press Enter, or select Add.
  2. Each added check appears as a removable chip. Select the remove control on a chip to drop that check.

Gate merges on a pipeline

The Pipeline gate group blocks merges, pushes, and merge-request opens into matching branches until the required pipeline passes. Jobs that are allowed to fail do not block.

  1. Select Require the previous pipeline to pass before merging to turn the gate on.
  2. In Which pipeline gates the merge, choose either This branch's own pipeline (current) or The predecessor branch's pipeline (previous). The predecessor option cannot be enabled on the first branch in the branch order; if you choose it there, the save is rejected and the reason appears beside the control.

Restrict who can push

The Push restrictions group limits direct pushes to matching branches.

  1. Select Restrict who can push to this branch. Additional fields appear.
  2. Optionally, add allowed users and groups by their IDs in Allowed users (UUIDs) and Allowed groups (UUIDs): paste an ID and press Enter, or select Add. Each entry appears as a removable chip.
  3. Administrators always keep push access. The allowlists are display only and are not enforced at merge time; the restriction toggle itself is enforced.

Edit a rule

  1. Find the rule in the list and select Edit. The form opens pre-filled with the rule's current settings.
  2. The Branch pattern cannot be changed while editing, as the form notes: to use a different pattern, delete the rule and create a new one.
  3. Change the review, pipeline, and push options as needed.
  4. Select Update rule to save your changes, or Cancel to leave the rule unchanged.

A Branch protection rule updated confirmation is shown once the change is saved.

Delete a rule

  1. Find the rule in the list and select Delete.
  2. In the Delete branch protection rule dialog, read the warning: "This will remove the protection rule and allow direct pushes to the matched branches."
  3. Select the confirm button, which names the pattern being removed, to delete the rule, or close the dialog to keep it.

A Rule deleted confirmation is shown, and direct pushes to the matched branches are allowed again.

View all branches

Below the rules, the All branches section lists every branch in the repository, with the note "All branches in this repository. Protected or default branches cannot be deleted here."

  • Each branch shows its name, a default badge on the default branch, a protected badge when a rule matches it, and the author and date of its latest commit.
  • When the repository has many branches, use ← Previous and Next → to page through the list.
  • Branches and tags — list, inspect, and delete branches, where protected and default branches are shown.
  • Merge requests — where required approvals and the pipeline gate take effect before a merge.