Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 520
Ortwin Gentz Avatar asked Apr 28 '10 11:04

Ortwin Gentz


People also ask

What is Project Pbxproj file?

pbxproj is an important file in the Xcode configuration bundle. It is responsible for maintaining references to all of the linked files and their groupings, linked frameworks, and most importantly, the project's build settings.

How do I cancel a merge?

How do I cancel a git merge? Use git-reset or git merge --abort to cancel a merge that had conflicts. Please note that all the changes will be reset, and this operation cannot be reverted, so make sure to commit or git-stash all your changes before you start a merge.


1 Answers

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
like image 172
VonC Avatar answered Oct 06 '22 15:10

VonC