Last active
August 25, 2019 19:17
-
-
Save doekman/002c8503d14310ac0b608d4d909b208c to your computer and use it in GitHub Desktop.
Convert git-log to markdown (NetNewsWire)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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