Merging branch into master in Xcode 11? - xcode

I must be missing something very simple here. I never had a problem merging branches into master on earlier versions of Xcode, but I don't have the option on any projects while using Xcode 11.
How should I merge into master? Thanks.

This is a frustrating Xcode 11 issue.
As a workaround you can checkout master first and then merge the required branch into it.

Related

Xcode 12.1 Source Control not showing all branches

In Xcode I can branch from master and push just fine. The new branch appears in Gitlab as one would expect.
When I use Xcode to clone the repo into a location, it asks me which branch to clone which seems fair. What I am confused about is that I can only see the cloned branch, not the other ones. If someone else (or I on another machine) create a branch, it won't update that addition on the other Xcode.
I know how to navigate branches via git in Terminal but then I don't understand why Xcode has the Branches entry to begin with. I can merge via Terminal but I thought the whole point of Xcode Source Control is to have a UI for visualizing conflicts etc.
Am I missing something or is this working normally for everyone else?
Ok I found it: https://stackoverflow.com/a/54921527/2161301
When you expand Remotes and origin you will find the other branches too. So the "top level" Branches entry seems to be exclusively for local ones.

Work on two branches of the same repository at once

I recently started working on a different branch of my repository, but I noticed that I had not merged my work from an earlier branch yet. I figured I could copy and paste the missing pieces over from one branch to the other but I'm not sure if I can open them in parallel in two separate instances of Visual Studio.
I believe you can still merge your previous branch into the one you are working on?
If you really really need to have both versions open at the same time, you could clone the same repository into another, seperate, folder and have the previous branch there and open that version of the project.

Xcode bot does not see repository branches

After updating the XCode to version 11.4 (11E146), I stopped seeing repository branches in the bot settings. But I see these repository branches in Source Controll Navigator. Does anyone know how I can fix it?
This issue was resolved in Xcode 12.
OLD answer & workaround for Xcode 11.4 - 11.x:
Unfortunately it's a known issue in the Xcode 11.4 release. https://developer.apple.com/documentation/xcode_release_notes/xcode_11_4_release_notes
Find this Stack Overflow answer to change the branch manually via the Xcode Server API: https://stackoverflow.com/a/42573925/1372065
Looks like this is fixed in XCode12, In case you still need to use XcodeServer on Xcode 11.4 - 11.5 then follow the below steps
In the final step, add a pre-integration script and add the below git commands
git pull
git checkout `your-branch-under-test`
git branch

Xcode tree conflicts on merge

I'm working in team with git and every time we try to merge code we have a tree conflict.
We're currently working with git flow and we usually start features from develop, when the task is finished one of us merges one feature into the other and then merge it into develop.
The problem is than every time we try to merge one feature into another we have a tree conflict in xcode and we don't know how to fix it.
The error message is: "The operation could not be performed because of one or more tree conflicts."
Please add .gitignore file if you have not added.
Refer link given below.
How to add .gitignore file into Xcode project
If it doesn't solve your problem, you can try to merge using terminal using given below command.
git mergetool
And then if there are any conflict then you can solve it.
I solved this by merging differently:
First I merged feature1 into develop, then I merged develop into feature2 and final feature2 in develop.
In this way there aren't tree conflicts.
This happened to me too. The problem was that the master branch had uncommited changes (unrelated to the changes in the other one). Switching to master and committing the changes allowed me to merge the feature branch back into master.
Try committing all the changes on all the branches and try the merge again after that.

Is it possible to replace the master branch in Xcode with my current "feature branch"

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!
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.
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.
In Xcode I went to Source Control-> Working Copies and selected my Development branch as the working copy.
Under Source Control, I did a Commit for all my pending changes
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
At the top of the Configure window, I selected Branches
I selected the Master branch and clicked on the - sign at the bottom and confirmed that I wanted to delete it.
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.
Named the new branch "Master". This made Master the current branch.
When back to Source Control and changed the current branch back to my Development branch.

Resources