Common Workflows¶
This page summarizes the commands you normally use after a project already has a prek.toml or .pre-commit-config.yaml.
Set Up Once¶
Install Git shims so prek runs automatically during Git operations:
If the repository used pre-commit before, overwrite the existing shims once:
Prepare hook environments ahead of time, which is useful for CI images or when you want the first commit to be fast:
Run Hooks¶
Run hooks for the files currently staged in Git:
Run hooks against the whole repository, commonly after changing hook configuration or before opening a PR:
Run a single hook by ID:
Run without changing files or executing hooks, to inspect what would run:
Inspect and Debug¶
List the hooks and projects discovered in the current workspace:
Validate configuration files:
Use .pre-commit-config.yaml instead if that is the repository's config file.
Inspect file type tags when types, types_or, or exclude_types filters do not match as expected:
Use verbose output when a hook fails in a way that needs more context:
Maintain Hooks¶
Update pinned hook repository revisions:
Prepare hook environments without touching Git shims:
Show or clean cached repositories, hook environments, and toolchains:
Where to Go Next¶
- Configuration covers config file formats, discovery, and validation.
- Workspace Mode covers monorepos and nested project configs.
- CLI Reference lists every command and option.