使用 git 进行数据版本控制:特定文件的自定义差异
因此,我想研究 git 对某些二进制或文本树数据结构的版本跟踪的适用性。问题是我希望 diff 逻辑是完全自定义的,针对数据结构模式量身定制的。
假设有问题的文件是某个 json 对象,我想要 json 文件的自定义差异 所以如果我的版本 A 是这样的:
{ a: 'yes' , b: { 'X': 'unavailable' , 'Y': ready } }
并且我应用了以下更改:
{ a: 'yes' , b: { 'X': 'unavailable' , 'Y': done } }
所以我的 diff 会很聪明地发现只有项目 1 已更改。默认情况下 diff,如果其他人对键 a、项 [0] 进行了更改,那么这将 产生冲突,需要手动合并。自定义差异的目的是 为特定文件类型和内容自定义差异逻辑。
二进制文件略有不同的情况也可能适用。
这个问题的目的是看看是否有:
- 方法
- 当前 git 中是否有支持这种定制项目或 git 开发分支的
- 来支持这种定制一些其他更好的工具,
谢谢!
编辑我发现
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以为二进制文件创建自定义差异视图 (“比较二进制文件”部分)就像 Word 文档一样。但这仅对查看差异有用,对于合并没有用。
我不知道有什么可以帮助你的。
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.