GitHub branch protection and required checks: no merge until the tests pass
Know why a team protects its main branch, how a failing required check blocks a merge, and what to read when it does.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a ticket gate that opens only for a green ticket. A red ticket waits. A green ticket walks through. A missing ticket also waits.
The gate is the branch rule. The green ticket is a passing . The red ticket is a failing one. A missing ticket is that never reported.
Leo, a developer at Daily List, a to-do list app, wants the gate on the main code. Tom, a tester, asks for it because a rushed merge can skip the suite. Mei, the test lead, wants main to stay green.
What it is: GitHub is a website that stores Git projects. Git is a different thing. It is a free program on your computer that keeps a full history and works offline. A is a rule on a branch such as main. It sets what must be true before a merge. A required check is an automatic job that must pass. The asks the branch to include the newest target-branch code before it can merge. A green tick you can click past is the nearest neighbour. The rule is what makes the tick a real gate.
Why it matters: Without the rule, someone can merge a once. Lily, who uses Daily List, then meets a failure the suite had already caught. Tom can trust a protected main branch only when the jobs he cares about had to pass.
PLAIN WORDS · 1 in this section
- github
- a web site that hosts code and runs checks
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB A train ticket gate that opens only for a green ticket.
- Gate
- Green
- Time
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| The ticket gate | The branch protection rule |
| The green ticket | A passing required check |
| The red ticket | A failing check |
| Checking the time on the ticket | The up-to-date setting |
WHERE THIS PICTURE STOPS
- A gate is in one station, but a rule can cover many branches.
- A green ticket suggests approval; a passing check may be skipped or neutral and does not prove every test executed.
- A ticket is stamped once, but a check can run again after each push.
HOOK
Gate and ticket.
TELL A FRIEND
A gate and a ticket.
OFTEN MIXED UP WITH GitHub pull requests and reviews: check work before it joins the main code. That topic reviews a change by reading it. This one makes the checks a rule, so a failing test blocks the merge.
Sources & standards — 3 sources
- Market practice
Protected branches ↗ — GitHub · Current GitHub Docs, accessed 7 November 2026 — Full operative branch-protection guidance: bypass, expected app, success/skipped/neutral, stale approvals and merge conditions.
Selected publisher sections read for Testing Tools audit. Current GitHub Docs, accessed 7 November 2026. This is not live service testing or a full-publication certification.
- Market practice
Troubleshoot required status checks ↗ — GitHub · Current GitHub Docs, accessed 7 November 2026 — Full operative status guidance: latest SHA/test merge, seven-day eligibility, skipped workflow versus job, eligible events and merge_group.
Selected publisher sections read for Testing Tools audit. Current GitHub Docs, accessed 7 November 2026. This is not live service testing or a full-publication certification.
- Market practice
Repository roles ↗ — GitHub · Current GitHub Docs, accessed 7 November 2026 — Full role matrix: Triage can apply labels/milestones and assign; creation and rule editing require different applicable permissions.
Selected publisher sections read for Testing Tools audit. Current GitHub Docs, accessed 7 November 2026. This is not live service testing or a full-publication certification.
PRACTISE AND KEEP
Sources for this topic — 3 sources
- Market practice
Protected branches ↗ — GitHub · Current GitHub Docs, accessed 7 November 2026 — Full operative branch-protection guidance: bypass, expected app, success/skipped/neutral, stale approvals and merge conditions.
Selected publisher sections read for Testing Tools audit. Current GitHub Docs, accessed 7 November 2026. This is not live service testing or a full-publication certification.
- Market practice
Troubleshoot required status checks ↗ — GitHub · Current GitHub Docs, accessed 7 November 2026 — Full operative status guidance: latest SHA/test merge, seven-day eligibility, skipped workflow versus job, eligible events and merge_group.
Selected publisher sections read for Testing Tools audit. Current GitHub Docs, accessed 7 November 2026. This is not live service testing or a full-publication certification.
- Market practice
Repository roles ↗ — GitHub · Current GitHub Docs, accessed 7 November 2026 — Full role matrix: Triage can apply labels/milestones and assign; creation and rule editing require different applicable permissions.
Selected publisher sections read for Testing Tools audit. Current GitHub Docs, accessed 7 November 2026. This is not live service testing or a full-publication certification.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.