Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get only the content of each commit in a json ? ( git diff json)

So I'm storring on my github all the differences I get on a json file during time ( I call an api that updates each time the json and only store the differences). To give you an idea ; It's the changes of availability, either an id is available or not. What I'm trying to do now : I want to get the content of each commit in a json file in my local machine. SO later I can loop through all the json files in sequence using nodejs or python and then generate a CSV with the data that interest me.

Thank you for your help,

like image 239
Marou Aityahia Avatar asked Apr 21 '17 12:04

Marou Aityahia


People also ask

What@@ means in git diff?

The fourth line shows you symbol @@ and symbols ahead of it. They are called chunks. Chunks in git diff define the change' summary. In our image below the following chunk can be seen @@ -1,2 +1 @@ This means that lines one and two were changed in the first file and line one was changed in the second file.

Is there a git diff?

Comparing changes with git diff Diffing is a function that takes two input data sets and outputs the changes between them. git diff is a multi-use Git command that when executed runs a diff function on Git data sources. These data sources can be commits, branches, files and more.

What is the difference between the git diff and git status?

The main difference between the commands is that git diff is specially aimed at comparisons, and it's very powerful at that: It can compare commits, branches, a single file across revisions or branches, etc. On the other hand, git status is specifically for the status of the working tree.

What does the command git diff do?

The git diff command helps you see, compare, and understand changes in your project. You can use it in many different situations, e.g. to look at current changes in your working copy, past changes in commits, or even to compare branches.


1 Answers

There is a couple of Gists adding support of log2json command to git:

  • https://gist.github.com/textarcana/1306223#file-git-log2json-sh - the original log2json command implementation
  • https://gist.github.com/dmegorov/b64dcea2eed31e02c916fc6ed9111f4f#file-git-log2json-sh - my version of the above with support of --name-only parameter

References:

  • Git log output to XML, JSON, or YAML?
  • Git log JSON *with changed files*
like image 112
Dmitry Egorov Avatar answered Sep 28 '22 07:09

Dmitry Egorov