Search code examples
iosxcodegitgit-mergeatlassian-sourcetree

Merge conflicts with project.pbxproj on Git - Xcode iOS


Although I already read similar comments here, in this forum, I haven't found an approach that may be suitable for teamwork in a seamless way.

If you know what I mean, you already may found tricky working with git and the project.pbxproj file in Xcode, even when you are working in a different file.

Say,

  • A developer: created Foo folder, adding foo.swift to the project.
  • B developer: created Bar folder, adding bar.swift to the project.

Different paths... but you know, conflict! And as you may also noticed, leaving project.pbxproj out is not an option.

So my question is: How do you handle this in a professional manner, Git flow ready and easiest way.

Thank you all very much.

PS: I'm using currently Bitbucket and SourceTree if matters.

PS2: I'd like to avoid command line and manually file editing if possible.


Solution

  • Create a .gitattributes file and adding the following line:

    *.pbxproj merge=union

    Merges will happen automatically and without you having to touch anything.

    Alternatively, you might try mergepbx, which does a more intelligent merge.