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 →
- Push ruleset with a maximum file size (for example 10 MB) and blocked extensions.
- Route legitimate large assets to Git LFS via
.gitattributes. - A CI check on the diff:
git diff --stator a script flagging files above the threshold. - Monitor repository size regularly:
git count-objects -vH, andgit sizerfor 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.
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