Skip to content

Instantly share code, notes, and snippets.

@TSchuermans
Last active March 29, 2016 17:47
Show Gist options
  • Save TSchuermans/eecf5c4c23aa96689445bb9f6103d75c to your computer and use it in GitHub Desktop.
Save TSchuermans/eecf5c4c23aa96689445bb9f6103d75c to your computer and use it in GitHub Desktop.
commit-msg
#!/usr/bin/env bash
# .git/hooks/commit-msg
pattern="(JIRA|PROJECTKEY)\-[0-9]"
check=$(grep -E "${pattern}" "${1}")
if [[ "${check}" != "" ]]; then
exit 0
else
echo "Invalid commit message, commit message should contain project key and issue key separated by a dash. e.g. JIRA-123"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment