Skip to content

Instantly share code, notes, and snippets.

@sevaho
Created October 14, 2019 14:25
Show Gist options
  • Save sevaho/3a46201a28c8d3567316cf0af8f8822d to your computer and use it in GitHub Desktop.
Save sevaho/3a46201a28c8d3567316cf0af8f8822d to your computer and use it in GitHub Desktop.
HISTORY.md generator, forgot to initiate a history file? well this is a small script that does it for you!
#!/bin/bash
tag_list_sorted=`git --no-pager tag --sort=-creatordate`
array=(${tag_list_sorted// / })
length_of_tags_min_1=$((${#array[@]}-1))
for (( c=$length_of_tags_min_1; c>0; c-- ))
do
l=`git log -1 --format=%ai ${array[(($c - 1))]}`
echo "### ${array[(($c - 1))]} $l"
echo -e ""
git --no-pager log --pretty=format:"%s, #%h by @%cn" ${array[$c]}...${array[(($c - 1))]} > /tmp/gitlog.txt
sed -i -e 's/^/- /' /tmp/gitlog.txt
cat /tmp/gitlog.txt
echo -e "\n"
done
# OUTPUT EXAMPLE:
#
# ### 0.0.0.1 2019-03-05 10:26:41 +0100
#
# - init repo, #a6f39a7 by @sevaho
# - added README, #062b9c1 by @sevaho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment