01Chapter 1: Why protect branchesThis chapter explains the risks that branch protection reduces and introduces the two mechanisms GitHub offers. Later chapters configure each one.2 min read
02Chapter 2: Classic branch protection rules and name patternsThis chapter assumes you know basic Git (branches, commits, merges, pushes), have used GitHub pull requests, and have admin access to a repository you can experiment in.2 min read
03Chapter 3: Requiring pull requests and approvalsThis chapter assumes you know Git branches, commits, and pushes, and have opened and merged a GitHub pull request. You also need admin access to a repository you can experiment in.2 min read
04Chapter 4: CODEOWNERS and code owner reviewThis chapter assumes you know how to open and review pull requests and that you can edit files and settings in a repository where you have admin access. It covers the CODEOWNERS file and how it connects to branch protection.2 min read
05Chapter 5: Requiring status checks before mergingThis chapter assumes you know Git branches and pull requests, and that you have a CI workflow that reports a result on each pull request. It also assumes admin access to a repository where you can experiment.3 min read
07Chapter 7: Should administrators be exempt?This chapter assumes you know how classic branch protection rules work and have admin access to a test repository. It covers how each system treats administrators and when an exemption is justified.2 min read
08Chapter 8: Rulesets and the rules they can enforceThis chapter assumes you know basic Git, GitHub pull requests, and the idea of required status checks. It also assumes you have admin access to a repository you can experiment in. You should have seen classic branch protection rules in earlier chapters.2 min read
09Chapter 9: Targeting branches and tags with ref name patternsThis chapter assumes you know what a ruleset is and can read the JSON body of a ruleset. It covers only which refs a ruleset applies to. Enforcement and bypass come later.1 min read
10Chapter 10: Evaluate mode, active mode, and bypass actorsThis chapter assumes you can create a ruleset, know what a pull request and a status check are, and have admin access to a test repository. It covers the two settings that control how a ruleset behaves: its enforcement status and its bypass list.2 min read
11Chapter 11: How multiple rulesets and branch protection combineThis chapter assumes you know how classic branch protection rules and rulesets work on their own. A single branch can be covered by several rule sources at once, so you need to know what happens when they overlap.2 min read
12Chapter 12: Protecting tags and restricting pushesThis chapter assumes you can create a ruleset and set its enforcement status, as covered earlier. It extends rulesets beyond branches to tags and to file-level push restrictions.2 min read
13Chapter 13: Applying rulesets across an organizationThis chapter assumes you can create a repository ruleset, set its enforcement status, and use a bypass list. It also assumes you know how ref name patterns work. Here you apply one ruleset to many repositories at once.2 min read
14Chapter 14: Merge queue as a ruleThis chapter assumes you can write a basic GitHub Actions workflow and have read the earlier chapters on required status checks and rulesets.2 min read
15Chapter 15: Automating with the REST API and gh CLIThis chapter assumes you know how classic branch protection and rulesets work, and that you have admin access to a repository you can experiment in. You also need the gh CLI installed and authenticated with gh auth login.2 min read
16Chapter 16: Choosing between branch protection and rulesets, and migratingThis chapter assumes you know how classic branch protection rules work, how rulesets target refs, and how evaluate mode and bypass actors behave. It helps you decide which system to use and how to move from one to the other.2 min read
17Chapter 17: Troubleshooting blocked pushes and mergesThis chapter assumes you know how classic branch protection rules and rulesets work, including status checks, CODEOWNERS, bypass actors, and how several rule sources combine on one branch. It gives you a repeatable way to find which rule is blocking you.2 min read