Skip to main content

Branch Protection: Require Linear History

The following rule type is available for requiring linear history on branches.

stacklok/branch_protection_require_linear_history - Whether the branch requires a linear history with no merge commits

Ensure that the setting to require a linear commit Git history is enabled for the branch protection rule.

This prevents merge commits from being pushed to matching branches.

For more information, see https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/managing-a-branch-protection-rule

Entity

  • repository

Type

  • stacklok/branch_protection_require_linear_history

Rule parameters

The stacklok/branch_protection_require_linear_history rule supports the following parameters:

  • branch (string) - The name of the branch to check. If left empty, the default branch will be used.

Rule definition options

The stacklok/branch_protection_require_linear_history rule supports the following options:

  • required_linear_history (boolean) - Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch.