IT lexicon › Web › Git hooks

Git hooks

Web På svenska → Updated: 2026-11-13

Scripts that Git runs automatically at critical points — before commit, push, or merge.

Git hooks are executable scripts in `.git/hooks/` that Git triggers before committing, pushing, or merging. A pre-commit hook can run linters, formatters, or tests before code enters the repository. A pre-push hook can reject a push if CI hasn't passed yet.

Hooks enable enforced code standards (all commits must pass prettier, all tests must pass) and automated CI integration without a central server. Libraries like Husky (for Node) abstract Git hook setup so a team can share the same rules and reduce friction.

← Back to the lexicon