iOS engineer who likes clean, simple designs and sans-serif.


Week 1 Day 2 – Github vs. project.pbxproj and storyboards

Today, I learned about the hell that can be git merging .pbxproj and .storyboard files in iOS. I got to experience first hand the importance of good clear commits.

Some thoughts on how to do this (better):

  1. Make one developer the “owner” and creator of storyboards and/or class files.
  2. Pre-plan + design the flow and create the initial class structure of the app upfront to reduce future headaches.
  3. Don’t forget the brute force method: ‘git checkout’ each branch to be merged and review the changes. Merge with the “other” branch and then manually apply your changes. [ Yuck ]
  4. In BASH or VIM, using sed to replace text could be very useful.
  5. In Sublime, using Control-Command-G on “< <<<<<< HEAD", "=======" and ">>>>>>> otherBranch” might be useful… or really dangerous.
  6. If you’re going to manually review all the conflicts one-by-one, make sure to also check that that XCode agrees that the error is resolved as well.
  7. After resolving conflicts, don’t forget to ‘git add’ the files. And re-open XCode.
  8. Regardless, I sense that I will be using these git commands a lot more in the coming days:

    git checkout --ours <filename>
    git checkout --theirs <filename>

    See keep either file in merge conflicts for more.

Leave a Comment