Compliance (SOC 2) requires two approvals, no self-merge and traceable changes.
AdvancedScenarioProtection, Hooks and Policy
Answer
Situation read → You need technical controls that map to the written policy.
What I'd do →
- Ruleset: 2 required approvals, dismiss stale approvals, require last-push approval, code owners for critical paths.
- Required checks and signed commits; no bypass except a break-glass team.
- Manage rules as code and export evidence (ruleset JSON, audit-log events, PR history).
- Review bypass events monthly.
Why → Auditors want evidence that the control is enforced, not just documented.
Interview tip → Say that the PR is the unit of change evidence: approvals, checks and the merge are all recorded.
More on Protection, Hooks and Policy
You are asked to protect `main`. Which rules do you turn on?BeginnerClassic branch protection or repository rulesets: which do you use?IntermediateA required status check never reports and the PR is stuck as "Expected — Waiting for status".IntermediateProduction is down and the fix needs to merge now, but approvals are required.IntermediateYou want to stop developers from committing obvious mistakes like debug prints, trailing whitespace or secrets.BeginnerHooks in `.git/hooks` are not shared with the team. How do you distribute them?Intermediate