Xcode tree conflicts on merge - xcode

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.

Related

Git with multiple changes

The current workflow for our developers is
Create a new branch from develop for each bug
Make your changes, and commit them
Create a Pull request
The issue :
I am working on bug 1, branch name develop_bug1 . I commit my changes in the file file1.jsp and create a PR
I now start working on bug 2, branch name develop_bug2. I find out that changes need to be made in the same file file1.jsp as bug 1. When I checkout develop_bug2, my changes from develop_bug1 aren't present.
What if I finish my changes for bug 2 and commit and create a PR? Will it overwrite changes for bug 1?
Not sure where to start
Changes on the two branches will not be present in the other branch or the develop branch until the two bug branches are merged. They are entirely separate ‘copies’ of the code.
Because both involve changes to the same file (file1.jsp) there are going to be so-called merge conflicts, which need to be managed.
Let’s assume that develop_bug1 is to be merged back into develop first (either because it is more urgent or because is has less changes).
Step 1: Merge develop_bug1 into develop. There will be no conflicts.
Step 2: Merge develop into develop_bug2. This is sometimes called rebasing. There will be merge conflicts which you will need to resolve. Your IDE will help you deal with the conflicts by selecting which version of each change to accept.
Step 3: Merge the updated develop_bug2 (which now includes changes originating in develop_bug1) into develop. There will be no conflicts.
If none of the PRs gets merged, then there are no conflicts in both of two branches.
If one of the PRs gets merged, then the second PR will get conflicts, we should resolve the conflicts first, push to remote, and then the second PR could be merged.
PS: always pull the lasted code into local branch before we raising a PR.

The operation could not be performed because "PROJECTNAME" has one or more tree conflicts

I am using Git and when I tried to pull a newer development branch with my current branch using XCode's source control menu I received this error message:
The operation could not be performed because "ProjectName" has one or more tree conflicts.
How do I resolve these tree conflicts?
Thanks
I was in trouble with this problem. It often happens when I remove or change the directory of the project .For example, when I move one directory into another existing directory,both of the directory are real folder the warning will exist.
In fact the meaning of tree conflict is that the directory level in your work repository is not same as it was on server.
It's my way to resolve this problem :
Check which directory in your local work repository differs from the server repository.
If the local repository has extra directory Delete(local) -> update ->OK ,
if the local repository lacks of something and the extra elements in server is needless, Delete (server) -> update.
NOTE After this the tree conflict is not existing any more.
Hope helps.
There is a conflict in the project file you need to pull using the command line or a GUI tool like SourceTree (Free) and manually resolve the conflict in a text editor or diff tool.
See also:How to use Git properly with XCode?
I had a similar issue. So I opened a terminal-windows and changed to the directory, verified my branch was clean with a git status, changed to master using git checkout master and merged my branch with git merge push-notifications. The Git Branching - Basic Branching and Merging page explains it in detail.
For me this error occurred when Xcode got confused on which branch the project was currently on. So I solved it by switching the branch to master and then back to the former branch again. So, try this simple fix first.
My situation. Merging the master branch with minor changes into my current in-development or working version.
I solved this issue by:
Moving the in-development file with the tree conflict to my desktop (i.e. out of the repository controlled directory).
Committing the most in-development version.
Re-execute the merge from the master into the most recent version.
Resolved actual merge conflicts.
Confirmed that the file that was merged from main into the in-development branch was there and correct.

Break the branch link for individual files in TFS

When we create a branch from our main trunk in TFS we also change the web.config to point to different databases, web services, etc. When we make a bug fix we do it in the release branch and merge back to the trunk. I'd like a way to click on the root node for the branch and merge the whole thing back to the trunk except for the web.config which has release-branch-specific settings which should not be merged back.
Is there a way to break the branch link for this file or is there some other method to permanently exclude the release web.config when merging back to the trunk?
You have two options to do this today:
Use "tf merge /discard". When performed on a file across branches it tells the merge engine that you do not want this specific change merged between these two branches. The downside of this approach is that you will need to run tf merge /discard each time you check in a change to the file. Here is what the syntax would look like if you wanted to discard the change from moving from releasebranch to trunk:
tf merge $/releasebranch/.../web.config $/trunk/.../web.config /discard
The second option is to cloak the web.config in the target branch when you are performing the merge. That is if you are merging into trunk, cloak the web.config file in the trunk branch in your workspace. When you perform the merge, since the target of the merge is cloaked, the change will not flow over the branch. The downside here of course is that you have to remember to perform the merges in workspaces with this configuration each time.
Bonus: I created this uservoice suggestion to improve this experience. Vote for it if this is something you would like to see improved.

TFS not showing Dev branch in target locations for merging

s/w versions:
TFS2008 server, VS2010, windows xp
I have the following branch structure in TFS
$/Root/Main Branch
$/Root/Dev/Project1
Project1 was branched off the Main Branch, few months ago. Now I need to merge the latest code in the Main Branch to the Project1 branch. During that time, some new folders were added to the Main Branch.(Main Branch/CoreDataClasses/..). So when I try to merge this new folder into the Project1 branch using the merge wizard, I don't see the Project1 branch in the list of target branches. Why is TFS not showing me my dev branch in the target branches list?
Do your merge from the root (where you branched), not the individual folder(s). Remember that merges aren't destructive until you check in, so you can choose to only check in the new folders if you want to hold off other changes.
With Tfs I've had much better experience merging from branch to the trunk and I think this might be the case here. Of course this might take a rethink of your strategy but it's doable.
I know this may be way offside but if you're doing cross branch merging a lot then definitely consider a distributed version control system like mercurial. I've used Tfs lots and really like it but when it comes to branching and merging it is a distant second to hg merge (mercurial command)
The folder structure between source and target have to be the at least 80% the same. If there was too many restructuring of the folder layout then I suggest you use the cmd line Merge with the force switch when doing the merge. See "Merge Command".

Is it possible to squash all changes from a branch in TFS into one commit?

For personal projects I use Git for SCM, but at work we use TFS. One thing that I like about Git is that it allows a person to easily squash all the changes made in a branch when pulling the changes back into the master branch.
The benefit of this is that if their is anything wrong with the changes they can easily be removed be reverting back to the version before the merge even if no tag was created.
Is this. or the equivalent possible in TFS? Is this where shelving changes fits into the equation?
Thanks.
Performing a merge in TFS results in a single commit; all of the changes from the source branch get rolled up into one changeset pended against the target branch. So as far as I understand your question, the answer is "yes".

Resources