Differences from pre-commit¶
General differences¶
preksupports.pre-commit-config.yaml,.pre-commit-config.yml, and nativeprek.tomlconfiguration files. Useprek util yaml-to-tomlto convert an existing YAML config.prekimplements some common hooks frompre-commit-hooksin Rust for better performance.preksupportsrepo: builtinfor offline, zero-setup hooks.prekuses~/.cache/prekas the default cache directory for repos, environments and toolchains.prekdecouples hook environments from their repositories, allowing shared toolchains and environments across hooks.preksupportslanguage_versionas a semver specifier and automatically installs the required toolchains.preksupportsfilesandexcludeas glob lists (in addition to regex) viaglobmappings. See Configuration Reference.preksupports ashellhook option for explicit shell-source execution through predefined adapters such asbash,sh, andpwsh. Upstreampre-commitrunsentrydirectly; shell behavior must be spelled intoentryitself.prekreports more precise configuration parsing errors, including exact source locations.
Behavioral divergences¶
These differences intentionally change upstream behavior instead of adding a compatible superset.
- File identification gives recognized extensions precedence over loose filename-prefix matches. For example,
makefile.pngis treated as a PNG image, while upstreamidentifyalso gives itmakefileandtexttags. Exact filename matches such asCargo.tomlstill keep their name-specific tags.
Workspace mode¶
prek supports workspace mode, allowing you to run hooks for multiple projects in a single command. Each subproject can keep its own prek.toml or .pre-commit-config.yaml file.
See Workspace Mode for more information.
Language support¶
See the dedicated Language Support page for a complete list of supported languages, prek-specific behavior, and unsupported languages.
Recent releases added support for more managed hook runtimes, including Bun, Julia, Deno, and experimental .NET support.
Managed runtime download verification¶
For supported managed runtime downloads, prek verifies the downloaded archive or installer against the checksum published by the runtime's own distribution channel before extracting or installing it.
This helps catch corrupted or unexpectedly changed downloads before they are unpacked. It does not add an independent trust root: if an upstream release, mirror, or checksum file is compromised together with the archive, SHA-256 verification alone cannot detect that.
uv downloads are not covered by this behavior yet.
Command line interface¶
For a compatibility-focused command mapping, see Compatibility with pre-commit.
prek run¶
prek run [HOOK|PROJECT]...supports selecting or skipping multiple projects or hooks in workspace mode, instead of only accepting a single optional hook id. See Running Specific Hooks or Projects for details.prek runcan execute hooks in parallel by priority (hooks with the sameprioritymay run concurrently), instead of strictly serial execution.- In workspace mode,
prek runcan execute independent projects at the same directory depth concurrently, while still running child projects before their parents. prekprovides dynamic completion for hook ids.prek run --dry-runshows which hooks would run without executing them.prek run --last-commitruns hooks on files changed by the last commit.prek run --directory <DIR>runs hooks on a specified directory.prek run --no-fail-fastlets you override the configuredfail_fastsetting for a single run and continue after failures.
prek install¶
prek installandprek uninstallhonor repo-local and worktree-localcore.hooksPathwhen choosing where to manage Git shims.
prek validate-config¶
prek validate-configaccepts bothprek.tomland.pre-commit-config.yaml.
prek list¶
prek list lists all available hooks, their ids, and descriptions. This provides a better overview of the configured hooks.
prek update¶
prek updateupdates all projects in the workspace to their latest revisions.prek updatechecks updates for the same repository only once, speeding up the process in workspace mode.prek updatesupports--dry-runto preview the updates without applying them.prek updatesupports--exit-codeto exit non-zero when updates are available, and--checkas an alias for--dry-run --exit-code.prek updatevalidates pinned SHA revisions against fetched upstream refs, including impostor-commit detection, and keeps stale# frozen:comments in sync when it can.prek updatesupports the--cooldown-daysoption to skip releases newer than the specified number of days (based on the tag creation timestamp for annotated tags, or the tagged commit timestamp for lightweight tags).prek updatesupports--exclude-repoto skip selected repositories while updating everything else.prek updatesupports tag filtering with--include-tag,--exclude-tag,--repo-include-tag, and--repo-exclude-tag, using glob patterns to keep or remove matching tags before selecting an update.
prek sample-config¶
prek sample-configcan generate either YAML or TOML and can write directly to a file with--file.
prek util¶
prek util identifyshows the file-identification tags prek uses for filtering and debugging hook selection.prek util list-builtinslists all built-in hooks bundled with prek.prek util yaml-to-tomlconverts.pre-commit-config.yamltoprek.toml.
prek cache¶
prekgroups cache maintenance underprek cacheinstead of separate top-levelcleanandgccommands.prek cache gcremoves unused cached repositories, environments and toolchains, and supports--dry-run.prek cache cleanremoves all cached data.prek cache dirandprek cache sizehelp inspect the cache before or after cleanup.
Not implemented¶
The pre-commit hazmat subcommand introduced in pre-commit
v4.5.0 is not
implemented. This command is niche and unlikely to be widely used.