policy name: non_linear_history
Prevent merge commits from being pushed to protected branches.
Having a non-linear history makes it harder to reverse changes, making recovery from bugs and security risks slower and more difficult.
- Note: The remediation steps applys to legacy branch protections, rules set based protection should be updated from the rules set page
- Make sure you have admin permissions
- Go to the repo’s settings page
- Enter “Branches” tab
- Under “Branch protection rules”
- Click “Edit” on the default branch rule
- Check “Require linear history”
- Click “Save changes”