1

I have been developing a feature for my app in Xcode. I use the master-branch as my stable/production-ready branch. When i work on a feature i start a feature-branch. This particular feature branch I have been using has had a lot of significant commits (30+ commits) and now when i try to merge it into my master-branch Xcode tells me there has been a conflict with various files and the merge is unable to be performed. There is no option to resolve the conflicts.

I am using Xcode 8.0. At this point the feature-branch is far ahead of the master-branch and is production ready. I would like to begin working on new features but i don't want to make a mess by creating more branches off of the current feature branch. The only thing I can think of is to just completely replace the master-branch with my feature-branch but is this even possible? If so then how?

I have been unable to find anything in Xcode, Apple documentation or on stack. Thanks for any advice!

rmaddy
  • 314,917
  • 42
  • 532
  • 579
MikeG
  • 3,745
  • 1
  • 29
  • 51
  • Can't you just use git from the command line? You can manually replace the branch using this answer: http://stackoverflow.com/questions/2763006/change-the-current-branch-to-master-in-git – Dekker1 Oct 13 '16 at 02:37

2 Answers2

3

What you should do here is merge your master-branch into your feature-branch. Fix your conflicts. Test, make sure it works. When you're convinced all is good, merge feature-branch back into master-branch.

During this time, you can still work in master-branch as needed. But keep in mind more conflicts could arise. And in that case, I'd also just do master-branch -> feature-branch -> master-branch where the "->" represents doing a merge.

For conflicts, I actually don't use Xcode to resolve, but there are numerous resources out there to indicate how to do this.

Mobile Ben
  • 7,121
  • 1
  • 27
  • 43
  • So stupid of me, thanks for the answer. All i had to do was go to master branch and choose Source Control-> Project -> merge FROM branch -> feature branch. – MikeG Oct 13 '16 at 03:26
  • 1
    Great. BTW, I would have done a merge Into branch then merge from. Just a matter of preference. You went straight from feature to master. With git you can always undo your merges so it really doesn't matter. But teams I've been on like the method I prescribed. – Mobile Ben Oct 13 '16 at 03:56
2

I had a similar situation, but Source Control in Xcode wouldn't let me merge branches due to "tree conflicts". It just hung. Good thing I had a backup, cause I could no longer open the project.

After restoring the project from my backup, I did the following to replace the Master branch with my Development branch.

  1. In Xcode I went to Source Control-> Working Copies and selected my Development branch as the working copy.
  2. Under Source Control, I did a Commit for all my pending changes
  3. In Source Control in the Working Copies section, I hovered over the the Development branch to expand the menu to the right and selected Configure project name
  4. At the top of the Configure window, I selected Branches
  5. I selected the Master branch and clicked on the - sign at the bottom and confirmed that I wanted to delete it.
  6. Went back to Source Control, hovered over the Development branch in the Working Copies section and selected New Branch from the menu that expanded to the right.
  7. Named the new branch "Master". This made Master the current branch.
  8. When back to Source Control and changed the current branch back to my Development branch.
Chris Neefus
  • 111
  • 3