Git Hooks Reference Library
Browse common pre-commit, commit-msg, and pre-push hook scripts with copy-ready bash code.
No hooks match your search.
Copied to clipboard
Summary
Browse common pre-commit, commit-msg, and pre-push hook scripts with copy-ready bash code.
How it works
- Select a hook type (pre-commit, commit-msg, pre-push, or all) to filter the library.
- Use the search box to find hooks by name or description keyword.
- Click any card to expand the full bash script.
- Click "Copy Script" to copy the ready-to-use code to your clipboard.
- Drop the script into your project's .git/hooks/ folder and make it executable with chmod +x.
Use cases
- Enforce code formatting with ESLint, Prettier, or Black before every commit.
- Block commits that contain debug statements, TODO comments, or API keys.
- Validate commit message format to keep the git log readable.
- Run a test suite before a push reaches the remote repository.
- Prevent direct pushes to protected branches like main or master.
Frequently Asked Questions
Last updated: 2026-06-09 ·
Reviewed by Nham Vu