Skip to content

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:

prek install

If the repository used pre-commit before, overwrite the existing shims once:

prek install -f

Prepare hook environments ahead of time, which is useful for CI images or when you want the first commit to be fast:

prek install --prepare-hooks

Run Hooks

Run hooks for the files currently staged in Git:

prek run

Run hooks against the whole repository, commonly after changing hook configuration or before opening a PR:

prek run --all-files

Run a single hook by ID:

prek run ruff

Run without changing files or executing hooks, to inspect what would run:

prek run --dry-run

Inspect and Debug

List the hooks and projects discovered in the current workspace:

prek list

Validate configuration files:

prek validate-config prek.toml

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:

prek util identify path/to/file

Use verbose output when a hook fails in a way that needs more context:

prek run -vvv

Maintain Hooks

Update pinned hook repository revisions:

prek auto-update

Prepare hook environments without touching Git shims:

prek prepare-hooks

Show or clean cached repositories, hook environments, and toolchains:

prek cache dir
prek cache gc
prek cache clean

Where to Go Next