Xcode Project file git merge conflict

前端 未结 8 1506
萌比男神i
萌比男神i 2021-01-31 03:28

In Xcode, what\'s the best way to avoid Git conflict in the project file? (I am in manual git, not using Xcode interface for git)

I\'ve cloned mapbox-ios-sdk from Github

8条回答
  •  轮回少年
    2021-01-31 03:47

    You should check my script xUnique, it is now the best solution to merge Xcode project file before Apple takes action on it.

    What it does & How it works

    1. convert project.pbxproj to JSON format
    2. Iterate all objects in JSON and give every UUID an absolute path, and create a new UUID using MD5 hex digest of the path
      • All elements in this json object is actually connected as a tree
      • We give a path attribute to every node of the tree using its unique attribute; this path is the absolute path to the root node,
      • Apply MD5 hex digest to the path for the node
    3. Replace all old UUIDs with the MD5 hex digest and also remove unused UUIDs that are not in the current node tree and UUIDs in wrong format
    4. Sort the project file inlcuding children, files, PBXFileReference and PBXBuildFile list and remove all duplicated entries in these lists
      • see sort_pbxproj method in xUnique.py if you want to know the implementation;
      • It's ported from my modified sort-Xcode-project-file, with some differences in ordering PBXFileReference and PBXBuildFile
    5. With different options, you can use xUnique with more flexibility

    Check README file for more details.

提交回复
热议问题