Created
December 14, 2015 18:53
-
-
Save martoo6/b4c64b2b798d617a44ae to your computer and use it in GitHub Desktop.
Jira Commiter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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