Sometimes Xcode gets confused with the intricacies of versioning. Frequently I find that I’m on a branch, everything is working fine, and for the life of me can’t merge it back into the Master branch. Often this happens because Xcode refuses NOT to make an change, such as update certain files I have already dealt with in the new branch.
That’s when the command line git tool can come in handy.
Suppose my new branch Mavericks is what I’d like to merge into master, but both Xcode and GitHub hang when trying to do so, citing “unrelolvable conflicts” and weird error messages. Rather than trying to understand them, it’s probably easier to just DELETE master and create a new copy from my Mavericks branch. Let’s do this.
First display what we have – cd into your working directory first, then issue
git branch * Mavericks master
OK, we’re on the Mavericks branch, and master also exists. Let’s delete master:
git branch -d master
Done and dusted – master is history. Let’s create a copy and call it master, then check it out:
git branch master git checkout master Switched to branch 'master' git branch Mavericks * master
Nice – looks like we’re all set here. You can also combine the “branch + checkout” command by typing “git checkout -b master”
Back in Xcode (and GitHub) everything seems fine too.