Git log as JSON array
git log \
--pretty=format:'{^^^^date^^^^:^^^^%ci^^^^,^^^^abbreviated_commit^^^^:^^^^%h^^^^,^^^^subject^^^^:^^^^%s^^^^,^^^^body^^^^:^^^^%b^^^^}' \
| sed 's/"/\\"/g' \
| sed 's/\^^^^/"/g' \
| jq -s '.'
The format is applied to each line to create a json object per line. Then jq --slurp
is used to "slurp" up the objects to create a valid json array object.
git log pretty format source: http://git-scm.com/docs/pretty-formats
Credit: