Re: Feature request: --format=json
- Date: Mon, 17 Apr 2017 15:09:20 +0200
- From: "Fred .Flintstone" <eldmannen@xxxxxxxxx>
- Subject: Re: Feature request: --format=json
So I would either have to do:
git rev-list --all
Then iterate over each line and do git-cat-file commit <commit-id>.
git rev-list --all | git cat-file --batch
If I do it in a batch, then it will be tricky to reliably parse since
I don't know when the message body ends and when the next commit
JSON output would have been very handy.
On Mon, Apr 17, 2017 at 2:59 PM, Duy Nguyen <pclouds@xxxxxxxxx> wrote:
> On Mon, Apr 17, 2017 at 7:44 PM, Fred .Flintstone <eldmannen@xxxxxxxxx> wrote:
>> So I did "git rev-list --all --pretty" and it looks like "git log".
>> Which outputs a human-readable format.
>> However, if I want something more suitable for machine parsing, is
>> there any way to get that output?
>> Example maybe I want another date format like ISO dates, or maybe a
>> serializable format like JSON or CSV or something. Maybe I want more
>> data than commit, auhor, date, subject and body?
> "git cat-file commit <commit-id>" should give you a machine-readable
> format of everything (it's the same thing that git-log parses and
> shows you; not counting options like --diff, --stat...). <commit-id>
> is from rev-list output (without --pretty, that's not for machine
> processing). You probably can use "git cat-file --batch" too, just
> pipe the whole rev-list output through it. You don't get to choose a
> convenient format this way though.