Coloque isso em um arquivo
#!/bin/bash
if [ "$#" -ne 2 ]; then
printf "Usage: $0 TAG1 TAG2RELEASE\n"
exit 1
fi
OLD__=$1
RELEASE__=$2
_FROM_TO_=$OLD__...$RELEASE__
touch CHANGELOG.md
_URL_=$(git ls-remote --get-url | sed -e "s/^git@/https\:\/\//g" -e "s/\.git//g")
grep -A 1 -nE '^CHANGELOG$' CHANGELOG.md | grep -q '=========' || printf 'CHANGELOG\n=========\n\n' >> CHANGELOG.md
_INSERT_FROM_=$(grep -nE '^CHANGELOG$' CHANGELOG.md | awk -F: '{print ($1 + 2);}')
_TODAY_=$(date +%Y-%m-%d)
grep "# $RELEASE__ \/ $_TODAY_" CHANGELOG.md
if [ $? -ne 0 ]; then
_INFO_="# $RELEASE__ / $_TODAY_\n"
sed -i "$_INSERT_FROM_ a $_INFO_ " CHANGELOG.md
_COMMITS_=$(git log $_FROM_TO --decorate=auto --no-merges --no-renames --pretty=format:"*[view]($_URL_/commit/%H) %s\n" --reverse | cat | tr -d '\n')
sed -i "$(($_INSERT_FROM_ + 1 )) a $_COMMITS_" CHANGELOG.md
printf "CHANGELOG.md updated\n"
else
printf "CHANGELOG.md already updated\n"
fi
Salve e chmod +x
Agora execute.