Lesson 14 / 18
Protecting the Main Branch
Rules that keep main stable by forcing changes through reviewed PRs.
Why protect main
Branch protection rules stop force-pushes and direct commits to main, requiring changes to go through a reviewed PR instead.
Required reviews & status checks
You can require at least one approval and passing CI checks before a PR is even allowed to merge.
Where to configure
Settings → Branches → Add rule — pick the branch pattern (e.g. main) and the requirements to enforce.