Skip to content

Instantly share code, notes, and snippets.

Last active Dec 18, 2015
What would you like to do?
Githook for requiring a JIRA issue in the commit message like [REALM-1234]. Place this in .git/hooks/
message=`cat $1`
prevLang=`echo $LANG` # this will get reset once we're done here
# The Portable-Git that comes with Github for Windows has a bash version of 3.1.0,
# so it doesn't understand regex matching. Use pattern matching instead.
# regex="(\[[A-Z]{2,5}-[0-9]{1,6}\]|\[NO-ISSUE\])"
export LANG="C.UTF-8" # apparently a case-sensitive regex is dependent on collation!
if [[ $message != $pattern ]]
echo "[POLICY] Your message does not contain a JIRA issue. Include [NO-ISSUE] if that's true."
export LANG="$prevLang"
exit $rc
Copy link

ckoppelman commented Jun 5, 2013

This is not supported by Github for Windows since that uses libgit and not git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment