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

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 →

  1. Commit .pre-commit-config.yaml with 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
  1. pre-commit install once per clone; pre-commit run --all-files to check everything.
  2. Run pre-commit in CI as well, and update versions with pre-commit autoupdate.

Why → Pinned revs give identical results everywhere.

Interview tip → Same config locally and in CI means no "passes locally, fails in CI".

All Git & GitHub questions Roadmap: Git & GitHub

More on Protection, Hooks and Policy