Interview Prep/Git & GitHub/Hooks, submodules, LFS and signing

What does the `commit-msg` hook receive and what is it good for?

IntermediateConceptHooks, submodules, LFS and signing
Answer

Git passes the path to a file holding the message as $1. The hook can validate Conventional Commit format, require a ticket ID, or append a trailer, then exit non-zero to reject.

grep -qE '^(feat|fix|chore|docs|refactor|test)(\(.+\))?!?: .+' "$1" || { echo "bad commit message"; exit 1; }
All Git & GitHub questions Roadmap: Git & GitHub

More on Hooks, submodules, LFS and signing