<!-- Branch protection | Merget Docs · https://merget.ai/docs/branch-protection -->

# Branch protection

Optionally require the Merget check in GitHub so people cannot merge out of queue order.

GitHub branch protection can require the Merget check before a person merges a pull request. Merget still plans and prepares its queue without this optional protection.

## What protection adds

A required Merget check lets GitHub hold manual merges while Merget reports Action required or Failure. A successful check permits the current queue decision: normally the head, or members of a ready batch or passing lane under their displayed order.

Keep your other required checks and reviews. A successful Merget check does not replace them or prove a build ran.

Advisory mode does not enforce an order, but its check fails when the analysis finds a blocking finding, a Break, an Interaction or a Review break, and is Neutral otherwise. A Review break blocks unless the repository sets `review.l1` to `advisory` or `off`; see [Review findings](https://merget.ai/docs/findings#review-findings). The failure refuses the merge only where branch protection requires the Merget check; without the requirement, GitHub shows the failed check and still lets the pull request merge. See [Findings in Advisory repositories](https://merget.ai/docs/findings#would-block).

The branch rule should require Merget from the installed Merget GitHub App. If an old rule still requires `sema`, update it to the current name. Merget renames such a rule itself when the App has Administration: write: in a ruleset it saves the ruleset as a whole, and a required `sema` check bound to no app is treated as Merget's.

## Up-to-date branches and batching

Require branches to be up to date before merging is often called strict protection.

Without batching, it keeps a manual merge from using an outdated target.

With batching through GitHub merges, it can limit a batch to one pull request because each merge leaves the next branch behind.

A compatible direct batch push can land the tested combination without updating every member branch separately.

Read the drawer's advice for your current configuration. See [Batching](https://merget.ai/docs/batching#strict-protection-limits-batches-to-one-pull-request).

## Set up a classic branch protection rule

Open Repositories › Configure, open Make GitHub require Merget's check (optional) under Readiness, and follow GitHub branch protection settings.

Add or edit a rule covering the target branch.

Require status checks and add Merget, selecting the Merget GitHub App as its source.

Choose whether branches must be up to date, based on your batching setup.

If the rule should govern administrators too, disable their bypass.

Keep the other checks and reviews you need and save.

### If the check is missing from GitHub's list

Open or update a non-draft pull request so Merget posts a recent check, then return to the selector. Confirm that the App can access the repository and that Merget is enabled for it.

## Set up a ruleset

In GitHub's repository settings, add or edit an active branch ruleset covering the target branch. Require Merget from the installed App alongside the other checks and reviews you need. Review the bypass list and up-to-date requirement deliberately.

A bypass can permit an actor to merge or push outside rules that constrain other users. Some direct batch landing options require the Merget App to be allowed to push; configure this only if it matches how you want batches to land. See [Fast-forward landing](https://merget.ai/docs/batching#prerequisites-for-fast-forward-landing).

A bypass is all-or-nothing: every rule of that ruleset is lifted for Merget's push, including rules Merget does not check itself, such as required deployments or workflows, or a pull request rule's required reviewers. Merget checks code-owner review, approval of the most recent push by someone other than its pusher, and review-thread resolution itself for every pull request it lands; it does not read required reviewers, so the pull requests its push lands past that ruleset do not wait for their review. Keep rules Merget should not bypass in a separate ruleset. See [When Merget lands by push](https://merget.ai/docs/security#push-landing).

A branch using GitHub's own merge queue requires manual merging through that workflow. See [Automation modes](https://merget.ai/docs/automation-modes#when-autonomous-mode-cannot-merge).

Illustration: classic branch protection and rulesets use different screens. The graphic names the rules to configure, not their exact placement.

What to look for

- In GitHub, protect the target branch shown in Merget. Require Merget and choose the installed Merget App as its expected source.
- Keep your existing checks and reviews. For classic protection disallow bypass; for a ruleset make enforcement Active and leave the bypass list empty.
- Enable up-to-date branches with batching off. Strict protection usually caps batches at one PR unless Merget’s fast-forward push lands them, as Autonomous fast-forward landing and Merge N PRs in Queue mode do; see the Batching guide’s prerequisites for fast-forward landing.

## Read the protection status

The status appears as Manual-merge protection in the configuration drawer's readiness summary, and as Optional GitHub protection in Queue controls. Allow time for Merget to recheck after changing GitHub settings.

| Status | Meaning |
| --- | --- |
| verified at last check | Merget recently confirmed the required App check, up-to-date requirement and absence of bypass. |
| not configured | The complete optional protection setup was not found. Read the details for what is missing. |
| not verified | Merget could not confirm the setup recently. |
| not applicable in Advisory mode | Advisory mode enforces no queue order. A required Merget check still refuses a merge its blocking finding fails. |

If you intentionally leave strict protection off for batching, the status can be not configured even while GitHub still requires the Merget check. Read the individual requirements rather than treating the status as a general security verdict.

A private repository whose GitHub plan offers neither branch protection nor rulesets (GitHub Free, or a private fork of a repository on it) has nothing to set up here: GitHub refuses both features there, so it can't require Merget's check. In Queue and Autonomous mode its status reads not configured. Queue controls and the configuration drawer say that GitHub can't require the check on this plan and quote GitHub's message about it. The drawer lists no steps and no protection details there. A batch's commit must pass only the checks you list under [Required CI checks](https://merget.ai/docs/batching#required-ci-checks). In Advisory mode GitHub can't require the Merget check there either, so a failing check doesn't refuse the merge.

Manual-merge protection reports the current verification state.

What to look for

- Re-check permissions reads GitHub's current permissions and protection. It does not change GitHub settings.
- Expand Make GitHub require Merget's check to review the optional protection setup. Keep your other required checks and reviews.

### Current protection details

The drawer explains missing requirements, unreadable rules or bypasses. Correct the named rule on GitHub, grant the App the needed access, or wait for a fresh check if settings changed while Merget was reading them.

A rule Merget cannot read is reported as unreadable, not as absent. If the same problem persists, share the repository and message with [support](https://merget.ai/docs/help).

## Turn off strict from Merget

When the drawer says Strict protection caps batches at one pull request, an organization owner with Admin access on GitHub can use Turn off strict, if the App has permission.

Click Turn off strict.

Read the confirmation, which names the target branch and the up-to-date requirement being removed.

Confirm the change.

Merget preserves the other checks and reviews. In a ruleset, the up-to-date rule is turned off on every status-check rule, for every branch the ruleset covers. Merget reports any organization rule it cannot change, so a partial result may still leave strict protection active. Activity records the request.

### Without the permission

Use Review the permission request on GitHub to have an installation administrator grant Administration: write, then Re-check permissions. Alternatively, change the up-to-date requirement directly in GitHub.

### When Merget cannot read the protection

The drawer explains that it cannot confirm whether strict protection applies. Check the rules on GitHub and the App's access before assuming a larger batch is available.

## Re-check permissions

After granting a GitHub permission, use the action beside the setting: Re-check permissions for strict-protection changes, or Try again in GitHub permission change required for a mode change. Settings › GitHub › Refresh rereads the connected installation.

See [Install the GitHub App](https://merget.ai/docs/github-app).
