Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
create valid JSON from git log using python and ast.literal_string
git log -n 10\
--pretty=format:'{"commit": "%H", "author": "%aN <%aE>", "date": "%ai", "message": """%B""", "notes": """%N""" },' \
$@ | awk 'BEGIN { print("[") } { print($0) } END { print("]") }' | python -u -c \
'import ast,json,sys; print(json.dumps(ast.literal_eval(sys.stdin.read())))'
@fi3ework

This comment has been minimized.

Copy link

@fi3ework fi3ework commented Jul 24, 2020

This script is awesome. Thanks.

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.