Skip to main content

Git Hook Generator

v1.0.3

Generate pre-commit and commit-msg hook script templates.

Generates pre-commit and commit-msg hook script templates for shell — validates message format, runs linters, blocks secrets, and runs tests before commit or push.

How to use
  • Select the hook type (pre-commit, commit-msg, pre-push) and add checks.
  • Each check can run a command and abort the commit if it exits non-zero.
  • Copy the script to .git/hooks/<hook-name> and chmod +x it.

Place in .git/hooks/pre-commit and chmod +x

Hook Script
#!/usr/bin/env sh
set -e

# pre-commit hook — generated by git-hook-gen

# Lint (ESLint / Ruff / golangci)
npm run lint