Hooks
Hooks
Create a pre-commit hook
See Pre-commit Hook for a full walkthrough — script creation, common checks, and sharing with the team.
Create a commit-msg hook
See Commit-msg Hook for a full walkthrough — message validation, Conventional Commits enforcement, and examples.
Share hooks with the team
$ mkdir .githooks
$ cp .git/hooks/pre-commit .githooks/
$ git config core.hooksPath .githooks
$ git add .githooks/
$ git commit -m "Add shared hooks"
Everyone who clones the repo runs git config core.hooksPath .githooks
to activate the shared hooks.
Bypass a hook
$ git commit --no-verify -m "WIP: skip hooks"
$ git push --no-verify
Use sparingly — hooks exist for a reason.