Skip to content

Instantly share code, notes, and snippets.

@mrmike
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

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

Select an option

Save mrmike/8a069fa628f2d529744e to your computer and use it in GitHub Desktop.
Prepare commit message
#!/bin/sh
# save file as .git/hooks/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