# pre-commit

24 Hacker News commenters recommended pre-commit and 20 criticized it, November 2025 to November 2026. It was recommended in 7 of 13 months.

**Verdict:** Runs linters and checks on changed files before each commit, and the same definitions can run in CI. Critics say hooks break with history edits and cross-platform builds.

## Why people recommend it

- Shared checks for local and CI (2 comments): "It's a really good way to share check definitions between local development and CI" ([source](https://news.ycombinator.com/item?id=46404216)) "Just add `pre-commit run -a` to your CI. Job done." ([source](https://news.ycombinator.com/item?id=47875038))
- Ready-made checks and a check runner (2 comments): "has a large ecosystem of off the shelf checks for various language linters and other checks" ([source](https://news.ycombinator.com/item?id=46879177)) "It's just handy as a check runner." ([source](https://news.ycombinator.com/item?id=46880815))
- Catches failures before CI (2 comments): "I've also found pre-commit useful to prevent CI failure." ([source](https://news.ycombinator.com/item?id=46409533)) "it saves them time as CI would fail anyway" ([source](https://news.ycombinator.com/item?id=46873826))
- Fast enough in everyday use (2 comments): "It adds negligible time to each commit and I have several hooks in use." ([source](https://news.ycombinator.com/item?id=46877598)) "I never have had an issue with performance with pre-commit?" ([source](https://news.ycombinator.com/item?id=46873784))

## What people warn about

- Hooks are fragile or the wrong approach (3 comments): "Pre-commit hooks are the wrong way to go about this stuff." ([source](https://news.ycombinator.com/item?id=46875261)) "Imho pre-commit is an antipattern. It tends to break" ([source](https://news.ycombinator.com/item?id=45976171)) "pre-commit is just a bad way to do this" ([source](https://news.ycombinator.com/item?id=46404335))
- Maintainer resists changes and feedback (3 comments): "I did some digging in the issues and PR's of pre-commit, the guy seems to be a major douche." ([source](https://news.ycombinator.com/item?id=45977410)) "the resistance to implement/merge useful things that basically everyone wants" ([source](https://news.ycombinator.com/item?id=45977651)) "The pre-commit author was straight up hostile to discussions of uv support" ([source](https://news.ycombinator.com/item?id=45976351))
- Breaks with history edits and rebases (2 comments): "trying to make them automatic just leads to pain when they interact with any non-trivial git feature" ([source](https://news.ycombinator.com/item?id=46404245)) "i regularly edit history of PRs for a variety of reasons and avoid pre-commit when possible." ([source](https://news.ycombinator.com/item?id=46876741))
- Fails when building on other platforms (2 comments): "That works fine for some things, but it doesn't work for building and testing on other platforms." ([source](https://news.ycombinator.com/item?id=47978948)) "you still have hooks building Python wheels and whatnot, which fails annoyingly often." ([source](https://news.ycombinator.com/item?id=46874100))

## Alternatives hackers recommend

- [prek](https://hackerapproved.com/p/prek.md): 13 recommend
- [Lefthook](https://hackerapproved.com/p/lefthook.md): 7 recommend
- [Husky](https://hackerapproved.com/p/husky.md): 6 recommend
- [hk](https://hackerapproved.com/p/hk.md): 5 recommend

## Cite as

Hacker Approved, "pre-commit", https://hackerapproved.com/p/pre-commit/ (counts from 1,795,640 Hacker News comments, November 2025 to November 2026).
