What it does
pre-commit is a framework for managing Git hooks that run before commits. Teams describe hook repositories, revisions, and selected hooks in a configuration file, install the Git hook with pre-commit, and let it set up hook environments as needed. It supports hooks written in multiple languages and can also run configured checks across all files.
Make checks part of the commit workflow
A typical setup adds a .pre-commit-config.yaml file with hook repositories, pinned revisions, and the checks a project wants to run. pre-commit install installs the Git hook; subsequent commits run the configured checks on relevant files. Teams can run pre-commit run --all-files to apply the hooks across a repository before adopting them as a commit gate.
The framework manages environments for hooks and supports multiple languages, so teams can combine formatters, linters, and other checks under one configuration. Hook availability and maintenance still depend on the chosen hook repositories, and the first run may need to prepare environments. This record describes the documented workflow rather than a configured project; no hooks were installed or run.
Strengths
- One configuration file can pin hook repositories and choose multiple checks.
- The framework manages hook environments and supports hooks written in multiple languages.
- Configured hooks can run automatically before commits or across all files on demand.
Watch out for
- Projects depend on the selected hook repositories and their maintenance, and initial environment setup can add work before the first run.
Best for
- Running formatting and lint checks before Git commits
- Standardizing repository hooks across a team or multiple languages
- Applying a chosen set of hooks across all files before enabling commit-time checks
Sources
- pre-commit (Oct 25, 2026)
- GitHub - pre-commit/pre-commit: A framework for managing and maintaining multi-language pre-commit hooks. · GitHub (Oct 25, 2026)
- pre-commit LICENSE (Oct 25, 2026)
