🔀Branch Protection
Also known as Protected Branch, Branch Protection Rule, Branch Ruleset
Rules that keep changes off a branch until reviews and tests pass.
Think of it like
Think of it like a lock on the front door. Only guests who pass the checks get in.
Example
Emma locks main on GitHub. Now each pull request needs one approval and passing tests before it can merge.
Why it matters
It turns good habits into rules the code host enforces.
Definition
Common mistake
Key takeaways
- 1Gate the branch. Changes come only through checks.
- 2Reviews and tests. Both must pass before merge.
- 3No force push. History on main cannot be rewritten.