Skip to content

Instantly share code, notes, and snippets.

@mmh
Last active December 6, 2017 14:48
Show Gist options
  • Save mmh/6347dca48ae8cea6cec19d66307a4c1a to your computer and use it in GitHub Desktop.
Save mmh/6347dca48ae8cea6cec19d66307a4c1a to your computer and use it in GitHub Desktop.
#!/bin/sh
# regex to validate in commit message
commit_regex='#[A-Z]{2,}-[0-9]+'
error_msg="Aborting commit. Your commit message is missing a JIRA Issue ('XXX-YY')"
if ! grep -qE "$commit_regex" "$1"; then
echo "$error_msg" >&2
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment