On Name Collision hackaton me and Dariusz Seweryn have started tool which helps iOS developers with merging code changes. Now it is finished and we are happy to share it with you (it is open sourced and hosted on GitHub):
SOCK - Simple Omitter of Conflicts Kit works by sorting (SOCK-sort ;) ) the project.pbxproj file every time a commit changes it. The script is triggered by git-hook, so usage is seamless. We came up with this tool after observing many merge conflicts when developers try to add groups, resources or files in iOS project at the same time.
These conflicts are usually caused by the less than optimal way Xcode adds new records to the pbxproj file. Xcode simply adds them at the bottom of the proper section(s). SOCK sorts pbxproj by name of the file, so it eliminates many of these conflicts simply by spreading line changes over the whole section.
To illustrate the problem we’ve made a simple test: We’ve created two branches A and B from the same revision, in each we’ve added new group and two classes: AGroup, AClass, AClass2, BGroup, BClass and BClass2.
In the standard way new records are added on bottom of the section:
The same situation happens for B branch. When we want to merge A and B branches we get merge conflicts because additional records are added on the same line:
When using SOCK added rows are spread all over the sections so chance of change in the same line is greatly reduced:
Merging SOCK-sorted branches: A and B, caused no merge conflicts.
Get the SOCK from GitHub and let us know what you think.
- Tomasz NetczukSenior Software Engineer