Should I merge .pbxproj files with git using merge=union?

前端 未结 2 1882
陌清茗
陌清茗 2020-12-05 10:34

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

The manpage states for this option:

Run 3-way

相关标签:
2条回答
  • 2020-12-05 11:24

    I have been working with a large team lately and tried *.pbxproj merge=union, but ultimately had to remove it.

    The problem was that braces would become out of place on a regular basis, which made the files unreadable. It is true that tho does work most of the time - but fails maybe 1 out of 4 times.

    We are back to using *.pbxproj -crlf -merge for now. This seems to be the best solution that is workable for us.

    0 讨论(0)
  • 2020-12-05 11:38

    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.

    • 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 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.

    • See also this question for potential conflicts.
    • See the Wikipedia article on Property List
    0 讨论(0)
提交回复
热议问题