Git Hooks
ELI5 — The Vibe Check
Git Hooks are scripts that Git runs at specific moments — before commit, after push, before merge. They're like event listeners for your version control. Want to enforce rules, run tests, or send notifications? There's a hook for that. They live in .git/hooks/ and most people never touch them directly.
Real Talk
Git hooks are scripts triggered by Git events (pre-commit, commit-msg, pre-push, post-merge, etc.). Client-side hooks run locally and aren't enforced across collaborators unless managed by tools like Husky. Server-side hooks (pre-receive, post-receive) run on Git servers for centralized enforcement.
When You'll Hear This
"Our pre-push hook runs the full test suite before allowing a push." / "Git hooks aren't shared by default — you need Husky or a similar tool to distribute them."
Related Terms
Commitlint
Commitlint is the grammar police for your commit messages. Try to commit with 'asdf fixed stuff'? Rejected.
Husky
Husky manages Git hooks in your Node.js project. Pre-commit? Pre-push?
Lint-Staged
Lint-Staged runs linters only on files you're about to commit, not the entire project. Changed 3 files? Lint those 3.
Pre-Commit Hooks
Pre-commit hooks are scripts that run automatically before every Git commit.