我应该使用merge = union将.pbxproj文件与git合并吗? [英] Should I merge .pbxproj files with git using merge=union?
问题描述
我想知道.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 aform 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.
- Yet, according to this question:
The truth is that it's way more harmful to disallow merging of that .pbxproj file than it is helpful.
The.pbxproj
file issimply 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.
- See also this question for potential conflicts.
- See the Wikipedia article on Property List
这篇关于我应该使用merge = union将.pbxproj文件与git合并吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!