Skip to content

Instantly share code, notes, and snippets.

@anamewing
Created January 19, 2018 13:01
Show Gist options
  • Save anamewing/64c7cee29722b31d195d95fb1a7c237e to your computer and use it in GitHub Desktop.
Save anamewing/64c7cee29722b31d195d95fb1a7c237e to your computer and use it in GitHub Desktop.
git export log to json
#!/usr/bin/env bash
git log \
--date=local \
--tags \
--pretty=format:'{%n "commit": "%H",%n "author": "%aN <%aE>",%n "date": "%cd",%n "message": "%f",%n "parentSha": "%P"},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment