You want a consistent set of formatters and linters on every developer machine.
BeginnerScenarioProtection, Hooks and Policy
Answer
Situation read → A shared hook configuration beats wiki instructions.
What I'd do →
- Commit
.pre-commit-config.yamlwith pinned versions:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: check-added-large-files
pre-commit installonce per clone;pre-commit run --all-filesto check everything.- Run
pre-commitin CI as well, and update versions withpre-commit autoupdate.
Why → Pinned revs give identical results everywhere.
Interview tip → Same config locally and in CI means no "passes locally, fails in CI".
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