Last active
August 11, 2017 07:48
-
-
Save StephaneTrebel/fd9058735fb03935b64aef19077ddc69 to your computer and use it in GitHub Desktop.
Automagically add the JIRA branch name to the commit message
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/sh | |
# Add "commitmsg": "./commitmsg.sh ${GIT_PARAMS}" to your package.json and use Husky to add it as a githook | |
TICKET=$(git symbolic-ref HEAD | rev | cut -d/ -f1 | rev | grep -o -E "[A-Z]+-[0-9]+") | |
if [ -n "${TICKET}" ]; then | |
# sed -e "1s/^/[${TICKET}] /" $1 | |
echo -n "[$TICKET]"' '|cat - "$1" > /tmp/out && mv /tmp/out "$1" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment