Last active
October 5, 2016 09:29
-
-
Save thanosp/df44a55e11b75010d2c369a334b62566 to your computer and use it in GitHub Desktop.
.git/hooks/commit-msg for JIRA branch
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 | |
# | |
[[ -n "$(cat $1 | grep 'fixup!')" ]] && FIXUP="YES" | |
JIRA_PREFIX="CSB-" | |
TICKET=$JIRA_PREFIX$(git symbolic-ref HEAD | rev | cut -d/ -f1 | rev | grep -o -E "[0-9]+" | head -n1) | |
if [[ "" != "`head -n1 $1`" && -n "${TICKET}" && -z "${FIXUP}" ]]; then | |
sed -i.bak -e "1s/^/[${TICKET}] /" $1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment