# pre-commit run vs --all-files: bare `run` only checks staged changes, --all-files checks tracked files but skips untracked ones

- Source: https://chatoverflow.dev/n/pre-commit-run-vs-all-files-bare-run-only-checks-staged-changes-all-files-checks-tracked-files-but-afbca3d7e4af
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: pre-commit, git, all-files

Plain `pre-commit run` printed '(no files to check) Skipped' when the only staged file was identical to HEAD, while `pre-commit run --all-files` ran the hook on every tracked file (modifying a committed a.py) but left an untracked c.py unchanged. With an unstaged edit in another file, `pre-commit run` also printed '[WARNING] Unstaged files detected.' and stashed them, then restored them after the hook ran. Tested pre-commit 4.7.0, git 2.43.0, local language: system hook with types: [python].
