Last active
October 28, 2018 03:01
-
-
Save codesman/d36360f100fe3b64ad30fa88dfc8e6f8 to your computer and use it in GitHub Desktop.
Git Hook to prepend Ticket Number to Commit Message
This file contains hidden or 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 | |
# JIRA Ticket Number will be prepended to message when running git commit | |
# Only on branches that have a ticket number | |
TICKET_NUMBER=$(git symbolic-ref --short HEAD | grep -o '[A-Z]\+-[0-9]\+') | |
MESSAGE=`cat $1` | |
if [ ! -z "${TICKET_NUMBER}" -a "${TICKET_NUMBER}" != " " ]; then | |
echo "${TICKET_NUMBER} ${MESSAGE}" > "$1" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment