Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env bash
commit_message=$1
commit_type=$2
commit_hash=$3
prefix="[commit prefix]"
heading=$(head -1 ${commit_message})
if [ -z "${heading}" ]
then
sed -i "1s/^/${prefix}: <insert heading here>\n/" ${commit_message}
elif [[ ${heading} != "${prefix}"* ]]
then
sed -i "1s/^.*/${prefix}: ${heading}/" ${commit_message}
fi
line_count=$(egrep -v "ChangeId|^#|^$" -c ${commit_message})
if [ ${line_count} -lt 3 ]
then
sed -i '2 a<insert description here>\n' ${commit_message}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.