Merging Branches
Moderator: SourceGear
Merging Branches
I have a Main branch (Main) that I broke off of to create a new branch (Release 1) to do some work in. After completing the work in Release 1 I removed access and created a new branch from Release 1 called Release 2. when work is completed in Release 2 i want to bring all the changes from Release 1 and Release 2 up to the Main branch.
My question is to bring up these changes to the Main branch do i have to merge Release 1 up then merge Release 2 up to the Main branch or is there a way to merge up the changes from Release 2 and it will include the changes made in Release 1 since the changes are already in Release 2 since it was derived from Release 1?
When i attempt to merge Release 2 up to the Main branch i only see the changesets from Release 2. Must i merge all the Release branches up in the order they were created to get all the changes made in the Release branches?
My question is to bring up these changes to the Main branch do i have to merge Release 1 up then merge Release 2 up to the Main branch or is there a way to merge up the changes from Release 2 and it will include the changes made in Release 1 since the changes are already in Release 2 since it was derived from Release 1?
When i attempt to merge Release 2 up to the Main branch i only see the changesets from Release 2. Must i merge all the Release branches up in the order they were created to get all the changes made in the Release branches?
So, if i understand you correctly, if i created Release 3 which was branched from Release 2 and wanted to merge all the changes made from Release 3, Release 2 and Release 1 into the Main branch (assuming i have not merged Release 1 or Release 2 into Main) then i would have to do the following:
1.) Merge Release 3 into Release 2
2.) merge Release 2 into Release 1
3.) finally Merge Release 1 into Main
If this is the case then i would just end up having 3 Release branches with the same code. The proj. mgr wants to keep the Release branches as they are for historical purposes. Is there anyway to move all the changes up to the Main branch without forcing the release branches to have the latest code?
1.) Merge Release 3 into Release 2
2.) merge Release 2 into Release 1
3.) finally Merge Release 1 into Main
If this is the case then i would just end up having 3 Release branches with the same code. The proj. mgr wants to keep the Release branches as they are for historical purposes. Is there anyway to move all the changes up to the Main branch without forcing the release branches to have the latest code?
A couple of ideas:
Create a branch from Main for each release, rather than branching the branch.
Or --
Branch, create Release 1, label, continue work for Release 2, label.
You will always be able to retrieve/view Release 1 and 2 via Get Label.
Chapters 7 and 8 of Eric Sink's Source Control HowTo has some useful information about branching and merging branches:
http://www.ericsink.com/scm/source_control.html
Create a branch from Main for each release, rather than branching the branch.
Or --
Branch, create Release 1, label, continue work for Release 2, label.
You will always be able to retrieve/view Release 1 and 2 via Get Label.
Chapters 7 and 8 of Eric Sink's Source Control HowTo has some useful information about branching and merging branches:
http://www.ericsink.com/scm/source_control.html
Linda Bauer
SourceGear
Technical Support Manager
SourceGear
Technical Support Manager
As I understand your structure, you have a Trunk, and have branched for Release 1. You later branched Release 1 creating essentially a Release 1.1 which you are calling Release 2.
In your situation, all changes made in the Release 1 branch exist in the Release 2 branch.
Now you want to merge all of the changes made in both branches back into your Trunk.
I think the best way to do that is to merge the Release 1 branch to the Trunk selecting all changesets, and then merge the Release 2 branch to the Trunk again selecting all changesets (except the initial branch changeset).
In a prior message conversation with Eric, I learned that the Merge branches uses the initial changeset selected as the base in doing a "3-way" merge. I suggested the 2 step merge above because of this.
If a file is unmergable (binary for example) the merge will still automatically update it (by overwriting it) if the target file is identical to the "base" file.
In addition the base file really will be the base file for a 3-way text file merge.
You could attempt to just merge the Release 2 branch to the Trunk without 1st merging the Release 1 branch and the end result would be the same. However the process is likely to be much more difficult with more merge conflicts and un-mergable files that you will have to resolve manually.
Eric please correct me if I've said anything that isn't true.
I hope this helps,
Mike
In your situation, all changes made in the Release 1 branch exist in the Release 2 branch.
Now you want to merge all of the changes made in both branches back into your Trunk.
I think the best way to do that is to merge the Release 1 branch to the Trunk selecting all changesets, and then merge the Release 2 branch to the Trunk again selecting all changesets (except the initial branch changeset).
In a prior message conversation with Eric, I learned that the Merge branches uses the initial changeset selected as the base in doing a "3-way" merge. I suggested the 2 step merge above because of this.
If a file is unmergable (binary for example) the merge will still automatically update it (by overwriting it) if the target file is identical to the "base" file.
In addition the base file really will be the base file for a 3-way text file merge.
You could attempt to just merge the Release 2 branch to the Trunk without 1st merging the Release 1 branch and the end result would be the same. However the process is likely to be much more difficult with more merge conflicts and un-mergable files that you will have to resolve manually.
Eric please correct me if I've said anything that isn't true.
I hope this helps,
Mike
When I tried just merging Release 2 into Trunk, the Release 1 changes were not incorporated in Trunk, even though Release 2 had all the content from Release 1.You could attempt to just merge the Release 2 branch to the Trunk without 1st merging the Release 1 branch and the end result would be the same.
Linda Bauer
SourceGear
Technical Support Manager
SourceGear
Technical Support Manager
Interesting, thanks Linda.
Now that you say that, I guess I can understand it. Only the actual changes made to the source file in the selected changesets are "merged" into the target file.
The expectation that the differences between the "base" file and the target file are all due to changes made to the target file since it was branched is false.
Thats the reason the changes between when the file was branched to Release 1 and when it was branched to Release 2 are not done during the merge.
I'll have to remember that.
Mike
In some future version of Vault I hope it will keep track of branches and merges so that it would always KNOW the real base file and not need to be told.
Now that you say that, I guess I can understand it. Only the actual changes made to the source file in the selected changesets are "merged" into the target file.
The expectation that the differences between the "base" file and the target file are all due to changes made to the target file since it was branched is false.
Thats the reason the changes between when the file was branched to Release 1 and when it was branched to Release 2 are not done during the merge.
I'll have to remember that.
Mike
In some future version of Vault I hope it will keep track of branches and merges so that it would always KNOW the real base file and not need to be told.