Skip to content
Latchkey

Pre-Commit Hook - CI/CD Glossary Definition

A pre-commit hook runs checks before a commit is recorded, blocking it if lint or tests fail.

A pre-commit hook is a script Git runs before a commit is recorded. It can lint, format, or test staged changes and abort the commit if checks fail, catching issues before they reach CI.

Fast local feedback

Pre-commit hooks shift checks left to the developer's machine, catching problems in seconds so CI is not spent on trivial style failures. CI should still re-run the checks as the source of truth.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →