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

`git commit` fails with `[ERROR] Your pre-commit configuration is unstaged. git add .pre-commit-config.yaml to fix this.`

IntermediateTroubleshootingSubmodules, LFS and Hooks
Answer

Likely causes → The pre-commit framework requires its config to be staged, because it stashes unstaged changes while running hooks and needs a consistent config.

Diagnose → git status -- .pre-commit-config.yaml

Fix → git add .pre-commit-config.yaml and commit again. If you intentionally do not want to commit it yet, stash your config change or temporarily skip with SKIP=hook-id git commit.

Prevent → Commit pre-commit config changes in their own commit, and run pre-commit run --all-files after changing hook versions (pre-commit autoupdate).

All Git & GitHub questions Roadmap: Git & GitHub

More on Submodules, LFS and Hooks