To require code review before changes reach a GitHub branch, protect that branch, require pull requests, and set a minimum approval count. In a repository, open Settings → Branches, add or edit a branch protection rule for the target branch or pattern, configure the review requirements, and save. A pull-request requirement and an approval requirement are separate controls, so enable both if every change must receive approval.
Set up a branch protection rule
- Choose the branch. In the repository, go to Settings → Branches and add or edit a rule. Set the branch name or pattern to match the branch where changes need review, such as the repository’s main development branch. A rule only applies to branches it matches.
- Require pull requests. Enable the option requiring a pull request before merging. This prevents changes from being merged directly under the rule, but does not by itself require anyone to approve the pull request.
- Set the approval minimum. Configure the required number of approving reviews. GitHub says eligible approvals come from people with write permission. Choose a count that fits the team’s size and the risk of changes; there is no universally suitable number.
- Choose what happens after new changes. Decide whether earlier approvals should remain valid or whether changes should trigger additional review. The two relevant options are described below.
- Save and check the rule. Save the settings, then use a pull request targeting the protected branch to verify that the rule matches the intended branch and that GitHub enforces the expected merge requirements. See GitHub’s branch protection rule guide.
Choose how approvals respond to new commits
New commits can alter what reviewers approved. GitHub offers two approaches for handling that change; choose according to how much re-review your workflow needs.
As an Amazon Associate I earn from qualifying purchases.
Dismiss stale approvals
Enable dismissal of stale pull request approvals when changes to the diff should invalidate earlier approval. A reviewer must then approve the updated changes. GitHub also documents cases where a changed merge base can make an approval stale. This approach is useful when the team wants approval to apply only to the code currently proposed, but it can mean repeating reviews as a pull request changes.
Free tools Windows power users keep installed
One-click scans. No signup required.
Require approval of the most recent reviewable push
Alternatively, require approval of the most recent reviewable push. The person who made that push cannot provide the qualifying approval; it must come from someone else. This focuses the requirement on review of the latest push rather than dismissing every earlier approval. See GitHub’s documentation on available rules for details.
#1 Best Overall
GitHub warns that either stale-approval dismissal or latest-push approval affects direct manual merge-commit pushes to a protected branch: the push fails unless the merge exactly matches GitHub’s generated merge.
Require review from code owners
For path-specific review, add a CODEOWNERS file and enable the code owner review requirement in the branch protection rule. GitHub looks for this file in .github/, the repository root, or docs/. Make sure its patterns cover the files that need ownership. If several owners match a file, an approval from any one of them satisfies that code owner requirement.
Rank #2
Protect the policy itself: GitHub recommends assigning an owner to the CODEOWNERS file or the .github/ directory. Otherwise, changes to ownership rules may not receive the intended oversight. More detail is in GitHub’s guide to code owners.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Branch protection rules or rulesets?
Classic branch protection rules are managed in Settings → Branches. Rulesets are an alternative way to apply repository policies. GitHub describes rulesets as easier to discover without admin access and able to apply multiple rulesets at once. The rules and behavior available differ, so teams using rulesets should consult GitHub’s current ruleset documentation rather than assuming every branch-protection option behaves identically.
Rank #3
Review is only one merge gate
Required approvals do not automatically enable other protections. Depending on the repository’s needs, configure separate requirements for status checks, conversation resolution, signed commits, linear history, merge queues, deployments, push restrictions, or bypass permissions. GitHub outlines these controls in its overview of protected branches.
GitHub documents branch protection for public repositories on Free, and for public and private repositories on Pro, Team, Enterprise Cloud, and Enterprise Server. Plan availability can change; check the current documentation for the account and GitHub product you use.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.




