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
Git Hook - CI/CD Glossary DefinitionGit Hook: A Git hook is a script Git runs automatically at points in its workflow, such as before a commit, b…
Linting - CI/CD Glossary DefinitionLinting: Linting is automated static checking that flags programming errors, bugs, stylistic issues, and susp…
Shift Left - CI/CD Glossary DefinitionShift Left: Shift left is moving testing, security, and quality checks earlier in the delivery process, so de…