# Protecting the Main Branch — GitHub

Source: https://www.geekswithgeeks.com/en/github/gh-branch-protection

> 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.
