Git log JSON *with changed files*

前端 未结 2 370
日久生厌
日久生厌 2021-01-17 03:49

I need to get the output of a git log command formatted as JSON. I like the approach suggested in Git log output to XML, JSON, or YAML? to use a custom git log pretty format

相关标签:
2条回答
  • 2021-01-17 04:22

    I've added --name-only parameter support to the original Noah Sussman's script so you can get the list of changed files using this command:

    git log2json --name-only
    

    The amended script is here.

    0 讨论(0)
  • 2021-01-17 04:27

    I know little about Perl. Here is my way to get the changed files of a commit. Hope it helps.

    git log -1 <sha1> --pretty=%h --name-only | tail -n +3
    
    0 讨论(0)
提交回复
热议问题