Skip to content

Instantly share code, notes, and snippets.

View marianabocoi's full-sized avatar

Mariana B. (she/her/they/them) marianabocoi

View GitHub Profile
@marianabocoi
marianabocoi / git-log2json.sh
Created October 11, 2015 11:55 — forked from textarcana/git-log2json.sh
Convert Git logs to JSON. The first script (git-log2json.sh) is all you need, the other two files contain only optional bonus features :)
#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--pretty=format:'{%n "commit": "%H",%n "author": "%an <%ae>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'