SVN: Create a branch from branch and merge to trunk
Asked Answered
R

2

15

We have a branch B1, and it is still not stable yet so it is not in trunk. But we want to work with changes from B1 so we create a branch B2 from B1.

So svn copy was done as follows

svn copy http://svn/trunk http://svn/B1

svn copy http://svn/B1 http://svn/B2 

After some days, B1 will be stable and B1 will be reintegrated to trunk.

Now, the problem lies with merging back of B2 to trunk. Do we reintegrate B2 back to B1 and then reintegrate to trunk or directly reintegrate B1->trunk and B2->trunk?

Rumpf answered 13/7, 2011 at 19:45 Comment(0)
S
10

Since you stated that you created B2 just to have the latest and greatest changes from B1, then I would say logically B2 is now dependent on B1, so I would go

B2 ---reintegrate branch--> trunk
B1 ---reintegrate branch--> trunk

Either reintegration can happen first.

You have to make sure that you keep B2 updated with any new Trunk or B1 commits, then you can pick during the update to B2 how to handle any conflicts.

As long as you do this, you can commit either branch first. You will be able to resolve any conflicts during the reintegrations.

When I branch, I branch even for very small changes, that way I have a branch per task and I can reintegrate them independently into the trunk in an order I need to...For the most part.

Shiprigged answered 13/7, 2011 at 19:57 Comment(2)
We are not concerned about isolating the issue, but we want to use certain features in B1. B1 might be reintegrated back to trunk before B2 gets reintegrated. Trunk->B1, B1->B2, B1->Trunk, B2->??Rumpf
See my updated answer. ?? should be trunk. SVN is busy tracking everything, and whether you reintegrate B1 first or B2, you will have to resolve conflicts if they exist. Like @Grammin's answer says, "keep your branches updated"Shiprigged
Y
6

You can reintegrate B2 directly back into the trunk. Just be careful that you don't go too long without merging back or taking updates from the trunk.

Yodle answered 13/7, 2011 at 19:50 Comment(2)
Should I be pulling changes from trunk?Rumpf
It depends on how many people are making changes to the trunk, if its just you and then another person working on the trunk you can probably go a bit. Just make sure you don't go to long without updating and then screw yourself because you have tons of conflicts.Yodle

© 2022 - 2024 — McMap. All rights reserved.