Skip to content

Instantly share code, notes, and snippets.

@rafaelrozon
Last active October 13, 2017 01:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaelrozon/22f1016a44d8805c9147fbff1a79086e to your computer and use it in GitHub Desktop.
Save rafaelrozon/22f1016a44d8805c9147fbff1a79086e to your computer and use it in GitHub Desktop.
NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch."$NAME".description)
TEXT=$(cat "$1" | sed '/^#.*/d')
if [ -n "$TEXT" ]
then
echo "$NAME"': '$(cat "$1" | sed '/^#.*/d') > "$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