Commit-editmsg Guide
Why is this revolutionary? Because you can programmatically validate or modify the commit message. Let’s write a simple commit-msg hook that rejects any commit whose subject line does not start with a JIRA ticket number (e.g., PROJ-123: Fix the bug ):
Located at .git/hooks/commit-msg (or in a shared template), this script runs after you have edited the COMMIT-EDITMSG file but before Git creates the commit. COMMIT-EDITMSG
But here is the crucial insight: