Skip to content

Instantly share code, notes, and snippets.

@mrmike
Last active December 8, 2015 13:47
Show Gist options
  • Select an option

  • Save mrmike/8bb221e6461cc44d62cb to your computer and use it in GitHub Desktop.

Select an option

Save mrmike/8bb221e6461cc44d62cb to your computer and use it in GitHub Desktop.
prepare-commit-msg
#!/bin/sh
# save file in .git/hooks/prepare-commit-msg
# chmod +x prepare-commit-msg
BRANCH=$(git symbolic-ref --short HEAD)
TICKET=`echo $BRANCH | grep -o 'MOB-\d\{1,\}'`
status=$?
if [ $status -eq 0 ] ; then
echo "[$TICKET]\n$(cat $1)" > $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment