Git Hooks Reference
All 8 hook scripts live in hooks/ and are symlinked to .git/hooks/ during install.
Hook Details
pre-commit
| Property |
Value |
| When |
Before a commit is created |
| Blocks commit? |
Yes exits non-zero on failure |
| What it does |
Formats staged files, runs linters, detects secrets, checks file size |
| Configure |
config/hooks.json → pre_commit section |
| Bypass |
git commit --no-verify |
commit-msg
| Property |
Value |
| When |
After commit message is written, before commit finalizes |
| Blocks commit? |
Yes |
| What it does |
Validates conventional commit format (type(scope): subject) |
| Configure |
config/hooks.json → commit_msg.allowed_types, max_subject_length |
| Allowed types |
feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert |
prepare-commit-msg
| Property |
Value |
| When |
Before commit message editor opens |
| Blocks commit? |
No |
| What it does |
Extracts ticket ID from branch name, prefixes commit message |
| Configure |
config/hooks.json → prepare_commit_msg.branch_prefix_regex |
| Example |
Branch feature/JIRA-123-foo → message prefixed with [JIRA-123] |
post-commit
| Property |
Value |
| When |
After commit is successfully created |
| Blocks commit? |
No |
| What it does |
Post-commit notifications or metrics collection |
| Configure |
N/A |
pre-push
| Property |
Value |
| When |
Before push sends data to remote |
| Blocks push? |
Yes |
| What it does |
Runs test command, blocks WIP commits on protected branches |
| Configure |
config/hooks.json → pre_push.test_command, protected_branches |
| Protected |
main, master, release/* |
pre-rebase
| Property |
Value |
| When |
Before rebase starts |
| Blocks rebase? |
Yes |
| What it does |
Prevents rebase on protected branches |
| Configure |
config/hooks.json → pre_rebase.protected_branches |
post-checkout
| Property |
Value |
| When |
After git checkout or git switch |
| Blocks? |
No |
| What it does |
Detects lockfile changes, optionally auto-installs dependencies |
| Configure |
config/hooks.json → post_checkout.lockfiles, auto_install |
| Lockfiles |
package-lock.json, yarn.lock, go.sum, Cargo.lock, requirements.txt, poetry.lock |
post-merge
| Property |
Value |
| When |
After a merge completes (including git pull) |
| Blocks? |
No |
| What it does |
Detects lockfile changes, optionally auto-installs dependencies |
| Configure |
config/hooks.json → post_merge.auto_install |