Last Updated: November 21, 2025
Focus Areas
| Focus |
|---|
Require passing CI checks before merging
|
Enforce reviews, approvals, and signed commits
|
Commands & Queries
gh api /repos/org/repo/branches/main/protection
Inspect protection settings
gh api -X PUT /repos/org/repo/branches/main/protection --body '{"required_status_checks": {"contexts": ["ci"]}}'
Update protection
git config --global commit.gpgsign true
Sign commits by default
Summary
Protect mainline branches with CI, reviews, and trusted signers.
💡 Pro Tip:
Require code-owner reviews for sensitive directories and enforce signed commits.