What branch protection settings do you enable on `main` by default?
BeginnerProductionBranch protection, rulesets, CODEOWNERS and review at scale
Answer
Require a PR with at least one approval, dismiss stale approvals on new commits, require status checks to pass (and branches up to date or use merge queue), require conversation resolution, require linear history if we squash, block force pushes and deletions, and apply the rules to admins too. Code owner review is added on sensitive paths.
More on Branch protection, rulesets, CODEOWNERS and review at scale
Why do rulesets win over classic branch protection for an organisation?IntermediateHow do you roll out a new org-wide ruleset without breaking 300 repos?AdvancedHow do you protect release tags from being moved or deleted?IntermediateHow do you structure CODEOWNERS for a large org?IntermediateCODEOWNERS says three teams own a path but PRs stall waiting for any one of them. How do you fix it?AdvancedWhy require status checks by job name and what is a common pitfall?Beginner