Interview Prep/Git & GitHub/Submodules, LFS and Hooks

The pre-commit hook takes 90 seconds on every commit, so people start using `--no-verify`.

IntermediateTroubleshootingSubmodules, LFS and Hooks
Answer

Likely causes → The hook lints, type-checks or tests the entire repo instead of the staged files, or downloads tools on every run.

Diagnose → time .git/hooks/pre-commit, then read what it runs.

Fix → Run checks only on staged files and move heavy work to CI:

# get staged files for a custom hook
git diff --cached --name-only --diff-filter=ACMR -- '*.py' | xargs -r ruff check

With the pre-commit framework, hooks already receive only staged files; with JS repos use lint-staged. Keep full test suites in pre-push or CI.

Prevent → Set a budget (a few seconds) for pre-commit hooks and measure it when adding new ones.

All Git & GitHub questions Roadmap: Git & GitHub

More on Submodules, LFS and Hooks