Skip to content

Instantly share code, notes, and snippets.

@nexeck
Last active December 16, 2015 09:49
Show Gist options
  • Save nexeck/5416011 to your computer and use it in GitHub Desktop.
Save nexeck/5416011 to your computer and use it in GitHub Desktop.
Generate valid JSON from git log
#!/bin/sh
git log --pretty=format:'"%h":{"commit": "%H", "authorDate": "%ad", "authorDateTime": "%ai", "authorName": "%an", "subject": "%s"}' --date=short | sed 's/\\/\\\\/g' | gawk 'match($0, /(.*"subject": ")(.*)("})/, ary) {printf "%s%s%s\n", ary[1], gensub("\"","~","g",ary[2]), ary[3]}' | sed -e '1s/^/{/g;s/$/,/g;$s/,$/}/g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment