prek
Fast pre-commit hook manager written in Rust
TLDR
SYNOPSIS
prek [global-options] command [command-options] [args]
DESCRIPTION
prek is a Git hook manager designed as a faster, drop-in replacement for pre-commit. It reads the same .pre-commit-config.yaml files and supports the same hook ecosystem, while shipping as a single static binary written in Rust with no Python runtime dependency.prek caches hook environments under ~/.cache/prek and reuses them across repositories. Several common hooks (file fixers, JSON/YAML validators, etc.) are reimplemented in Rust and run as built-ins, avoiding the cost of spawning interpreters. Toolchain installs for Python, Node.js, Bun, Go, Rust, and Ruby are shared across hooks, and Python environments are managed through uv.In addition to the legacy YAML schema, prek understands a native prek.toml format and provides prek util yaml-to-toml to migrate existing configurations. Workspace mode lets a single config drive hooks across multiple sub-projects in a monorepo, with --project and --skip-project filters on the command line.
PARAMETERS
install [--hook-type type] [--overwrite]
Install Git hooks into .git/hooks. Repeat --hook-type to install pre-commit, commit-msg, pre-push, etc.uninstall [--hook-type type]
Remove previously installed hooks while leaving prek's cache intact.run [--all-files] [--files path...] [--hook-stage stage] [--from-ref ref] [--to-ref ref] [--last-commit] [--show-diff-on-failure] [--no-fail-fast] [hook-id]
Execute hooks. With no arguments, runs against staged files; with --all-files, runs against every tracked file.auto-update [--check] [--bleeding-edge] [--freeze] [--cooldown-days N] [--repo url]
Update rev: entries in the configuration to the latest released tag. --check validates without rewriting.list [--hook-stage stage]
Show the resolved list of hooks for the active configuration.clean
Remove cached hook environments from prek's store.gc
Garbage-collect unused repos from prek's cache.init-templatedir directory
Populate a Git template directory so newly cloned repos pick up hooks automatically.try-repo repo [--ref ref]
Try a hook repository without modifying the project configuration.util yaml-to-toml [path]
Convert .pre-commit-config.yaml into the native prek.toml format.util list-builtins
List built-in hooks reimplemented in Rust.util identify file...
Print the file types prek associates with the given paths (useful for debugging types filters).self update
Upgrade the prek binary itself to the latest release.-c file, --config file
Use file as the configuration instead of auto-discovery.-v, --verbose
Increase log verbosity. Repeat for debug-level output.-q, --quiet
Suppress non-essential output.--color when
auto, always, or never.-V, --version
Print the version and exit.
CONFIGURATION
prek reads the first of these files in the repository root:
.prek.toml
.pre-commit-config.yaml
CAVEATS
prek aims for behavioural parity with pre-commit but is not byte-identical: Python virtualenvs are managed by uv, not virtualenv, which can change resolved package versions. Hooks that rely on system Python being on PATH during the hook script may need explicit dependencies. The cache layout under ~/.cache/prek is independent of pre-commit's, so both tools can coexist but do not share environments.
HISTORY
prek is authored by Jian Zeng (j178) and published as a Rust crate as well as a Python wheel on PyPI for installation via pip, uv, or pipx. It positions itself as a "pre-commit, reimagined", reusing the existing hook ecosystem while replacing the runtime. Early adopters include large Python projects such as CPython, Apache Airflow, and FastAPI.
SEE ALSO
pre-commit(1), husky(1), lefthook(1), uv(1)
