Skip to content

Instantly share code, notes, and snippets.

@shamique
Last active August 18, 2018 16:04
Show Gist options
  • Save shamique/ac367154688a34fa26c94251847d9d2b to your computer and use it in GitHub Desktop.
Save shamique/ac367154688a34fa26c94251847d9d2b to your computer and use it in GitHub Desktop.
git hook example - commit-msg
#!/bin/sh
# regex pattern for standard message
message_format='^\ABC-[0-9]{4}'
if ! grep -iqE "$message_format" "$1"; then
echo "Error: commit message should follow the pattern of ABC-1234 commit message"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment