Skip to content

Instantly share code, notes, and snippets.

@brianjriddle
Created May 30, 2012 09:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianjriddle/2835110 to your computer and use it in GitHub Desktop.
Save brianjriddle/2835110 to your computer and use it in GitHub Desktop.
git post commit hook to trigger if commit message has a key word that starts with %
#!/bin/sh
#will priint out a message if a commit contains a keyword prefixed with %
#
MARKERS="%\w+"
RELEASE=$(git log $(git reflog -n 1 | cut -d ":" -f1) | grep -Pio "$MARKERS"| sort -fu | tr '\n' ' ')
if [ "$RELEASE" != "" ];
then
echo "**************************************************************"
echo " NEED to RELEASE \033[1;31m$RELEASE\033[00m before releasing $(basename $(pwd))"
echo "**************************************************************"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment