Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

data versioning with git : custom diff for specific files

So, i want to investigate git applicability to version tracking of certain binary or text tree data structures. The thing is that i want that the diff logic be completely custom, tailored for the data structure pattern.

Assume the file in question is certain json object, i want a custom diff for json files so if i have version A as this:

{ a: 'yes' , b: { 'X': 'unavailable' , 'Y': ready } }

and i apply the following change:

{ a: 'yes' , b: { 'X': 'unavailable' , 'Y': done } }

so my diff would be smart to spot that only the item 1 changed. With default diff, if someone else made a change in, say, in the key a, item [0] then this would produce a conflict that needs to be manually merged. The custom diff would aim to customize diff logic for specific file types and contents.

Something slightly different for binary files might also apply.

The purpose of this question is to see if there are:

  • ways in current git to support this customization
  • projects or branches of git development to support this customization
  • some other tool better aimed for this

thanks!

Edit i found this article, which i think gives a very broad scope of the sort of thing i'm wondering about. Also it is probably a sign that there is really no good solution for this problem as of yet.

like image 750
lurscher Avatar asked Feb 05 '12 23:02

lurscher


1 Answers

You can create custom diff view for binary files (section "Diffing Binary Files") like Word documents. But this is useful only for viewing the differences, not for merging.

I don't know about anything that can help you with that.

like image 115
svick Avatar answered Sep 19 '22 16:09

svick