我应该使用merge = union将.pbxproj文件与git合并吗? [英] Should I merge .pbxproj files with git using merge=union?

查看:226
本文介绍了我应该使用merge = union将.pbxproj文件与git合并吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道.gitattributes中的merge = union选项对.pbxproj文件是否有意义。



此选项的联机帮助页:


为文本文件运行3向文件级合并,但从两个版本中取行,而不是留下冲突标记。这往往会以随机顺序在生成的文件中留下添加的行,用户应该验证结果。


通常,罚款90%的情况下添加文件到项目。

解决方案

不是直接的经验,


  • 这个 SO问题真的再次合并 .pbxproj 文件。




pbxproj 文件不是真正的人类可合并。

虽然它是纯ASCII文本,但它是一种形式的JSON 。基本上你想把它当作一个二进制文件。


(因此 gitignore 解决方案



实际上, Peter Hosey 在评论中添加了:


这是 属性列表 ,而不是JSON。相同的想法,不同的语法。






< blockquote>

事实是,禁止合并.pbxproj文件比有用的更有害。

.pbxproj 文件是简单的JSON (类似于XML)。从经验来看,只有两个人在同一时间添加文件,你所遇到的唯一的合并冲突。 99%的合并冲突案例中的解决方案是保持合并的两侧。


gitattributes merge directive )是有意义的,但做一些测试,看看它是否与上一个问题中提到的脚本相同。




I'm wondering whether the merge=union option in .gitattributes makes sense for .pbxproj files.

The manpage states for this option:

Run 3-way file level merge for text files, but take lines from both versions, instead of leaving conflict markers. This tends to leave the added lines in the resulting file in random order and the user should verify the result.

Normally, this should be fine for the 90% case of adding files to the project. Does anybody have experience with this?

解决方案

Not a direct experience, but:

  • This SO question really advices again merging .pbxproj files.

The pbxproj file isn't really human mergable.
While it is plain ASCII text, it's a form of JSON. Essentially you want to treat it as a binary file.

(hence a gitignore solution)

Actually, Peter Hosey adds in the comment:

It's a property list, not JSON. Same ideas, different syntax.

The truth is that it's way more harmful to disallow merging of that .pbxproj file than it is helpful.
The .pbxproj file is simply JSON (similar to XML). From experience, just about the ONLY merge conflict you were ever get is if two people have added files at the same time. The solution in 99% of the merge conflict cases is to keep both sides of the merge.

So a merge 'union' (with a gitattributes merge directive) makes sense, but do some test to see if it does the same thing than the script mentioned in the last question.

这篇关于我应该使用merge = union将.pbxproj文件与git合并吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆