Last active
January 3, 2017 17:27
-
-
Save lxhunter/fe5384d28da3d0ed2efba33c61051779 to your computer and use it in GitHub Desktop.
Git commit-msg hook to validate for semver
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
#!/usr/bin/env bash | |
# cd /to/where/the/repo/is/ | |
# wget -O .git/hooks/commit-msg https://gist.githubusercontent.com/lxhunter/fe5384d28da3d0ed2efba33c61051779/raw/commit-msg.sh | |
# rm .git/hooks/commit-msg.sample | |
# chmod +x .git/hooks/commit-msg | |
message=$(cat $1) | |
if ! [[ "$message" =~ ^\[(patch|minor|major)\] ]]; then | |
echo "Commit aborted! Your commit message is missing semantic versioning [patch|minor|major]" >&2 | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment