Created
June 2, 2017 20:49
-
-
Save shawnzhu/804b7e5618eaced72dc592e0cd36ca64 to your computer and use it in GitHub Desktop.
a commit-msg git hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COMMIT_MSG="$(head -n 1 "$1")" | |
if [[ "${COMMIT_MSG:0:1}" =~ [^A-Z] ]]; then | |
>&2 echo Commit message must be capitalized. | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to install it
git hooks
by following this guide: https://github.com/git-hooks/git-hooks#installgit hooks install
under your git repo directory~/.githooks/commit-msg
like~/.githooks/commit-msg/capitalize
How to use it
when you run command
git commit -m "<something>"
, it will fail if the commit message is not capitalized.