Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert git-log to markdown (NetNewsWire)
#!/usr/bin/env bash
# Unofficial Bash Strict Mode
set -euo pipefail
IFS=$'\n\t'
function group_on_date {
awk $'NR==1 {
cur_year=substr($1,1,4)
cur_month=substr($1,6,2)
printf "## %s\\n", cur_year
}{
year=substr($1,1,4)
month=substr($1,6,2)
if (year != cur_year) {
cur_year=year
cur_month="01"
printf ".\\n\\n## %s\\n", year
}
if (month != cur_month) {
cur_month=month
printf ".\\n\\n%s",$2
} else {
if ($1 == "2018-08-28" && ($2=="Start" || $2=="Continue")) {
if ($2=="Start") printf " **🎉[%s][home]",$2
else printf " [%s][home]🏡**",$2
} else {
printf " %s",$2
}
}
}
END {
printf ".\\n"
}'
}
#git clone https://github.com/brentsimmons/NetNewsWire.git
#cd NetNewsWire
git log --reverse --date=short --pretty='%ad %s' | group_on_date
# Top 35 used verbs
# git log --reverse --pretty='%s'|awk '{print $1}'|sort|uniq -c|sort -r|head -n 35
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.