Skip to content

Instantly share code, notes, and snippets.

@martoo6
Created December 14, 2015 18:53
Show Gist options
  • Save martoo6/b4c64b2b798d617a44ae to your computer and use it in GitHub Desktop.
Save martoo6/b4c64b2b798d617a44ae to your computer and use it in GitHub Desktop.
Jira Commiter
#!/bin/bash
BRNCH=$(git rev-parse --abbrev-ref HEAD)
MSG=$1
RE='^[A-Z]+-[0-9]+$'
EXTRACT=$(echo $BRNCH | cut -d'-' -f 1-2 | awk '{print toupper($0)}')
if [[ $EXTRACT =~ $RE ]]; then
CMTMSG="$EXTRACT - $MSG"
echo "Commit message: $CMTMSG"
git commit -m "$CMTMSG"
else
echo "Invalid branch name"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment