prek
prek is a Rust-based reimplementation of the pre-commit framework that serves as a faster, dependency-free, drop-in alternative. It maintains full compatibility with existing .pre-commit-config.yaml files while providing significant performance improvements, reduced disk usage, and an enhanced CLI experience.
Key Features
Performance
prek executes multiple times faster than the original pre-commit tool while using approximately half the disk space. It achieves this through shared toolchain management across hooks, parallel repository cloning and hook installation, and concurrent hook execution based on priority levels.
Drop-In Compatibility
prek reads the same .pre-commit-config.yaml configuration files as pre-commit. Migrating from pre-commit requires no configuration changes:
pre-commit uninstall && prek installBuilt-In Hooks
prek includes Rust-native implementations of common hooks, available through the repo: builtin configuration option. These hooks require no external toolchain installation.
Monorepo Support
prek provides built-in workspace and monorepo support, allowing multiple .pre-commit-config.yaml files across subprojects within a single repository.
Zero Runtime Dependencies
prek ships as a single binary with no Python or other runtime dependency requirements. It manages Python versions and virtual environments automatically when needed by hooks, integrating with uv for Python dependency handling.
Installation
# Using uv (recommended)
uv tool install prek
# Using pip or pipx
pip install prek
pipx install prek
# Using Homebrew
brew install prek
# Using Cargo (requires Rust 1.89+)
cargo install --locked prek
# Using Conda
conda install conda-forge::prekSee the official installation guide for additional methods including standalone installers, npm, Nix, Scoop, and GitHub Actions.
Command-Line Interface
# Install git hooks
prek install
# Run all hooks against staged files
prek run
# Run all hooks against all files
prek run --all-files
# Run a specific hook
prek run ruff
# Run hooks against files in a specific directory
prek run --directory src/
# Run hooks against the last commit
prek run --last-commit
# List all available hooks
prek list
# Update hook repositories
prek auto-update
# Clean cached environments
prek clean
# Self-update prek
prek self updateLanguage Support
prek supports hooks written in the following languages and toolchains:
- Python
- Node.js
- Bun
- Go
- Rust
- Ruby
See the language support documentation for current status.
Pros
- Significant speed improvement over pre-commit
- Drop-in replacement with no configuration changes
- Single binary with no runtime dependencies
- Reduced disk usage through shared toolchains
- Built-in monorepo and workspace support
- Parallel hook execution
Cons
- Not all pre-commit languages are fully supported yet
- Newer project with a smaller community than pre-commit