Skip to content

Instantly share code, notes, and snippets.

@saml
Created March 5, 2014 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saml/9368402 to your computer and use it in GitHub Desktop.
Save saml/9368402 to your computer and use it in GitHub Desktop.
#!/bin/bash
#~/.git_template/hooks/commit-msg
[[ "" != "$(grep -e '[A-Z]\+-[0-9]\+' "$1")" ]] || {
cat "$1"
echo >&2 "ERROR: No Jira ticket."
exec < /dev/tty
read -r -p "Proceed? [Yn]> " answer
if [[ "$answer" = "n" ]]
then
echo >&2 "Commit message saved to $1."
exit 1
else
echo "Proceeding without Jira ticket..."
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment