resolving xcode git merge conflict
TRANSCRIPT
![Page 1: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/1.jpg)
Resolving Xcode’s git merge Conflict
Ricardo Pramana Suranta
@edopelawi
![Page 2: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/2.jpg)
![Page 3: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/3.jpg)
![Page 4: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/4.jpg)
Xcode loves Git.
![Page 5: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/5.jpg)
Git, not SVN or Mercurial 🤔
![Page 9: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/9.jpg)
Xcode loves Git.
![Page 10: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/10.jpg)
💢 💢
👊💥
Real love is hard love.
![Page 12: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/12.jpg)
*.pbxproj conflict problems
• It’s opaque, Xcode-generated.
• It makes no sense.
![Page 13: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/13.jpg)
How to fix this?
• Famous last words: “I’ll do it manually.”
![Page 14: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/14.jpg)
How to fix this?
• Famous last words: “I’ll do it manually.” 💀
![Page 15: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/15.jpg)
How to fix this?
• Famous last words: “I’ll do it manually.” 💀
• Let Git fix it.
![Page 16: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/16.jpg)
Fixing using Git?
Add
*.pbxproj binary merge=union
to .gitattributes file
(https://robots.thoughtbot.com/xcode-and-git-bridging-the-gap)
![Page 17: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/17.jpg)
How to fix this?
• Famous last words: “I’ll do it manually.” 💀
• Let Git fix it. ❌
![Page 18: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/18.jpg)
💢 💢
👊💥
![Page 19: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/19.jpg)
How to fix this?
• Famous last words: “I’ll do it manually.” 💀
• Let Git fix it. ❌
• Let Xcode fix it.
![Page 20: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/20.jpg)
Fixing using Xcode?
• Clear project structure
![Page 21: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/21.jpg)
Clear project structure
Domain > Type > File(in the Finder / real folders, too)
![Page 22: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/22.jpg)
Clear project structure
Groups in Xcode Full path (Xcode’s Inspector bar)
Folder structure(Finder)
![Page 23: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/23.jpg)
Fixing using Xcode?
• Clear project structure
• Pick higher priority changes using git checkout --theirs / --ours
![Page 24: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/24.jpg)
Deciding change priority on *.pbxproj
• Prioritize changes on build settings (build number, post build script, framework, etc.)
• On file changes, always pick other people’s changes over ours.
![Page 25: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/25.jpg)
Deciding change priority on *.pbxproj
👩 👱Anna’s changes: - Bumped build number - Changed provisioning profile
Bob’s changes: - Added new files
![Page 26: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/26.jpg)
Deciding change priority on *.pbxproj
👩 👱Anna’s changes: - Bumped build number - Changed provisioning profile
Bob’s changes: - Added new files
Higher priority
![Page 27: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/27.jpg)
Deciding change priority on *.pbxproj (As Bob)
👩 👱Anna’s changes: - Bumped build number - Changed provisioning profile
Bob’s changes: - Added new files
Pick the other branch (git checkout --theirs *.pbxproj)
![Page 28: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/28.jpg)
Deciding change priority on *.pbxproj (As Anna)
👩 👱Anna’s changes: - Bumped build number - Changed provisioning profile
Bob’s changes: - Added new files
Pick the her own branch (git checkout --ours *.pbxproj)
![Page 29: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/29.jpg)
Fixing using Xcode?
• Clear project folder structure
• Pick higher priority changes using git checkout --theirs / --ours
• Drag and drop folder to Xcode as groups
![Page 30: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/30.jpg)
How to fix this?
• Famous last words: “I’ll do it manually.” 💀
• Let Git fix it. ❌
• Let Xcode fix it. ✅
![Page 31: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/31.jpg)
How to improve?
• Make script / app to automate Xcode’s *.pbxproj update process to replace drag-and-drop step
• Using folder references for prevent drag-and-drop (?)
![Page 32: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/32.jpg)
Further reading
• Vincent Driessen’s successful Git branching model (http://nvie.com/posts/a-successful-git-branching-model/)
![Page 33: Resolving xcode git merge conflict](https://reader034.vdocuments.net/reader034/viewer/2022052705/586fb1411a28abe57d8b6453/html5/thumbnails/33.jpg)
Thank You! :)