Interview Prep/Git & GitHub/Protection, Hooks and Policy

The team wants a strictly linear history on `main`.

BeginnerScenarioProtection, Hooks and Policy
Answer

Situation read → No merge commits at all.

What I'd do →

  1. Enable "Require linear history" in the ruleset.
  2. In repo settings, allow only squash merge and/or rebase merge; disable merge commits.
  3. Developers rebase their branches before merging.

Why → Linear history is easier to bisect, revert and read.

Interview tip → Rebase-merge keeps each commit; squash-merge keeps one. Be ready to justify your pick.

All Git & GitHub questions Roadmap: Git & GitHub

More on Protection, Hooks and Policy