Last active
August 7, 2017 15:28
-
-
Save kmccarth/524fff7a456bee55bdbe76452827662e to your computer and use it in GitHub Desktop.
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/sh | |
# | |
# Automatically adds branch name and branch description to every commit message. | |
# | |
NAME=$(git branch | grep '*' | sed 's/* //') | |
DESCRIPTION=$(git config branch."$NAME".description) | |
TEXT=$(cat "$1" | sed '/^#.*/d') | |
JIRAURL="https://ventureapp.atlassian.net/browse/"$NAME; | |
if [ -n "$TEXT" ] | |
then | |
echo "$NAME"': '$(cat "$1" | sed '/^#.*/d') > "$1" | |
echo "" >> "$1" | |
echo "Jira Link: "$JIRAURL " (might not work)" >> "$1" | |
echo "" >> "$1" | |
if [ -n "$DESCRIPTION" ] | |
then | |
echo "" >> "$1" | |
echo $DESCRIPTION >> "$1" | |
fi | |
else | |
echo "Aborting commit due to empty commit message." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment