Skip to content

pre-commit

A framework that runs code-checking hooks automatically before each git commit.

Stars
15.7k
Forks
1k
Licence
MIT
Language
Python
Last update
16 days ago
Type
Dev tool

What it is

pre-commit is a framework for managing and maintaining pre-commit hooks, which are checks (such as linters or formatters) that run automatically before a git commit is saved. It supports hooks written in multiple languages, so one tool can coordinate checks from different ecosystems. The README is brief and points to the project website for full documentation.

  • Run a linter automatically before each commit to catch problems early
  • Manage a shared list of hooks that a team uses across projects
  • Combine hooks written in different languages under one configuration

Great for

  • Teams that want consistent code checks run on every commit
  • Developers working in projects that use several programming languages
  • Maintainers who want to share a standard set of hooks across repositories

Not ideal for

  • People who only want a one-off lint run, since the README describes setting up ongoing hooks rather than manual checks
  • Anyone not using git, since the tool is built around git commits
Step-by-step guide: how to use pre-commitInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python · git

    Clone the repository

    git clone https://github.com/pre-commit/pre-commit.git
  2. 2

    Run it

    • Install pre-commit using a Python package manager or the release file, as described on the project website
    • Add a configuration file that lists the hooks you want to run
    • Install the git hook so checks run on each commit
    • Run the hooks against your files to confirm they work
  3. 3

    Get the most out of it

    • Read the full documentation at pre-commit.com for configuration details not in the README
    • Use the shared hook repositories the framework supports to reuse existing checks

Downloads

Strengths

  • Focused purpose: it manages git pre-commit hooks
  • Supports multi-language hooks, according to the description
  • Widely starred and has an active release history (latest v4.7.0 in the metadata)

Trade-offs

  • The README provided is truncated and gives little detail on configuration, so most usage information must come from the external website
  • Hooks it runs may be slow or may block commits if they are poorly chosen, a general trade-off of this approach

How it compares

ProjectStarsTypeLevelUpdatedBest for
pre-commit (this)15.7kDev toolintermediate16 days agoTeams that want consistent code checks run on every commit
husky35.4kDev toolbeginner8 months agoJavaScript or Node.js projects that want shared pre-commit checks
lint-staged14.8kDev toolintermediate6 days agoJavaScript or Node.js projects that already use tools like ESLint or Prettier
delta32.6kDev toolbeginner9 days agoDevelopers who read a lot of git diffs or git show output in the terminal
standard29.4kDev toolbeginner1.3 years agoJavaScript projects where the team wants consistent style without debating rules
eslint27.6kDev toolintermediate4 days agoJavaScript developers who want automatic checks on their code

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.