Git Merging binary files (specifically Xcode project files)

I have an Xcode project under git, and I have an "experimental" branch of my "master" branch. Both branches diverge from the branch (so there is no fast forward!), And I combine the "experimental" in my "magic" branch.

I installed the .gitattributes file to process a specific Xcode file (project.pbxproj) as a binary file, since it should be treated as such. However, I am not sure how to merge it. I'm not sure what this particular file is doing, but if, for example, it processed the files that were added to the project, I would not be able to combine them, and therefore I would have to manually add certain files to the project (perhaps without remembering all of them ) How do others deal with this situation?

Also, I read that you need to manually update the binaries (obviously) or copy different versions. However, as soon as I enter the merge process, the file in my working copy is the "main" version. How can I access the "experimental" version? I cannot verify this, as this will disrupt the merge process.

Thank you for your time!

+6
git xcode
source share
1 answer

In general, for binaries, I recommend the type of merging copies of the .gitattribute directive .
That is, I just copy the file coming from the remote end of the merge.

However, for .pbxproj files this may not be very good, as described here .

Wrapping these files will only exacerbate the problem, as far as I can tell, since you cannot merge the changes completely.
Although you can combine project files in some cases, this is not something you need to count on being able to do. The main recommendation is to avoid editing project files at the same time as someone else.

I like version project files (e.g. for Eclipse ) only if I know that they are:

  • not often changed (of course, not every developer)
  • using relative paths only
  • There is no data specification for one workstation.

In short, if these files are not merged (or will be trivial to merge), I want them in VCS. In your case, it may not be so useful to have them in the mentioned VCS in the first place.


Note: as stated in the Git manual :

During merge, the index contains three versions of each file. Each of these three β€œfile steps” represents a different version of the file:

 $ git show :1:file.txt # the file in a common ancestor of both branches $ git show :2:file.txt # the version from HEAD. $ git show :3:file.txt # the version from MERGE_HEAD 
+9
source share

All Articles