Created
November 7, 2024 17:33
-
-
Save spelufo/5897f547173eeead0f2b3b819afbee7c to your computer and use it in GitHub Desktop.
Convert git log output to JSON
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
# Similar to https://til.simonwillison.net/jq/git-log-json | |
git log --pretty=format:'%H%x00%an <%ae>%x00%ad%x00%s%x00' | python -c 'import sys, json | |
for line in sys.stdin: | |
commit, author, date, *message = line.split("\x00") | |
print(json.dumps({"commit": commit, "author": author, "date": date, "message": message[0]})) | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment