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

Large binaries keep landing in the repo and clones are getting slow. What controls would you add?

AdvancedScenarioProtection, Hooks and Policy
Answer

Situation read → Prevention is cheaper than history rewriting.

What I'd do →

  1. Push ruleset with a maximum file size (for example 10 MB) and blocked extensions.
  2. Route legitimate large assets to Git LFS via .gitattributes.
  3. A CI check on the diff: git diff --stat or a script flagging files above the threshold.
  4. Monitor repository size regularly: git count-objects -vH, and git sizer for deeper analysis.

Why → Once a blob is in history, only a rewrite removes it and everyone must re-clone.

Interview tip → Mention git-sizer as the tool for finding why a repo is slow.

All Git & GitHub questions Roadmap: Git & GitHub

More on Protection, Hooks and Policy