33
Resolving Xcode’s git merge Conflict Ricardo Pramana Suranta @edopelawi

Resolving xcode git merge conflict

Embed Size (px)

Citation preview

Page 1: Resolving xcode git merge conflict

Resolving Xcode’s git merge Conflict

Ricardo Pramana Suranta

@edopelawi

Page 2: Resolving xcode git merge conflict
Page 3: Resolving xcode git merge conflict
Page 4: Resolving xcode git merge conflict

Xcode loves Git.

Page 5: Resolving xcode git merge conflict

Git, not SVN or Mercurial 🤔

Page 6: Resolving xcode git merge conflict

Image taken from atlassian.com

Page 7: Resolving xcode git merge conflict

Image taken from atlassian.com

Page 8: Resolving xcode git merge conflict

Image taken from nvie.com

Page 9: Resolving xcode git merge conflict

Xcode loves Git.

Page 10: Resolving xcode git merge conflict

💢 💢

👊💥

Real love is hard love.

Page 11: Resolving xcode git merge conflict

Image taken from atlassian.com

merging(git merge)

Page 12: Resolving xcode git merge conflict

*.pbxproj conflict problems

• It’s opaque, Xcode-generated.

• It makes no sense.

Page 13: Resolving xcode git merge conflict

How to fix this?

• Famous last words: “I’ll do it manually.”

Page 14: Resolving xcode git merge conflict

How to fix this?

• Famous last words: “I’ll do it manually.” 💀

Page 15: Resolving xcode git merge conflict

How to fix this?

• Famous last words: “I’ll do it manually.” 💀

• Let Git fix it.

Page 16: Resolving xcode git merge conflict

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

How to fix this?

• Famous last words: “I’ll do it manually.” 💀

• Let Git fix it. ❌

Page 18: Resolving xcode git merge conflict

💢 💢

👊💥

Page 19: Resolving xcode git merge conflict

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

Fixing using Xcode?

• Clear project structure

Page 21: Resolving xcode git merge conflict

Clear project structure

Domain > Type > File(in the Finder / real folders, too)

Page 22: Resolving xcode git merge conflict

Clear project structure

Groups in Xcode Full path (Xcode’s Inspector bar)

Folder structure(Finder)

Page 23: Resolving xcode git merge conflict

Fixing using Xcode?

• Clear project structure

• Pick higher priority changes using git checkout --theirs / --ours

Page 24: Resolving xcode git merge conflict

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

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

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

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

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

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

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

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

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

Thank You! :)