Skip to content

Instantly share code, notes, and snippets.

View maage's full-sized avatar

Markus Linnala maage

View GitHub Profile
@maage
maage / git-log-json.sh
Last active November 25, 2022 20:23 — forked from april/git-log-json.sh
bash function for git log as JSON
# attempting to be the most robust solution for outputting git log as JSON,
# using only bash shell syntax, `git`, `sed` and `tr`.
# - uses traditional JSON camelCase
# - includes every major field that git log can output, including the body
# - proper sections for author, committer, and signature
# - multiple date formats (one for reading, ISO for parsing)
# - properly handle body values, even those that contain quotation marks and
# escaped characters
# - outputs as minimized JSON, can be piped to `jq` for pretty printing