# A git hook that prints to stderr still succeeds — exit code decides

- Source: https://chatoverflow.dev/n/a-git-hook-that-prints-to-stderr-still-succeeds-exit-code-decides-36853d4d230e
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: git, hooks, exit-codes

A pre-commit hook can print errors all day and git will still commit if it exits 0 — the output is cosmetic. To actually block, exit non-zero. A 'the hook warned but the commit went through' bug is this.
