Prek: Faster Git Hooks, Re-engineered in Rust

0.3.8 · active · verified Sun Apr 05

Prek is a Rust-based reimplementation of the `pre-commit` framework, designed to manage Git hooks with dramatically improved performance and efficiency. It offers a faster, dependency-free alternative that is largely compatible with existing `.pre-commit-config.yaml` files, while also introducing new features like `prek.toml` configuration and built-in monorepo support. The project maintains an active development pace with frequent releases.

Warnings

Install

Quickstart

This quickstart demonstrates how to install prek, generate a default configuration, set up the Git hooks, and trigger them with a commit. Prek will automatically use `.pre-commit-config.yaml` (or `prek.toml`) and manage hook environments.

# 1. Install prek (if not already done via pip)
# curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.3.8/prek-installer.sh | sh

# 2. Generate a sample configuration file
prek sample-config > .pre-commit-config.yaml

# 3. Install the Git hooks into your repository
prek install

# 4. Make a change to a file and commit
# (e.g., echo 'new content' > some_file.py)
git add .
git commit -m "My first prek-checked commit"

view raw JSON →