Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN: Create a branch from branch and merge to trunk

Tags:

svn

svn-merge

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?

like image 812
Alagu Avatar asked Jul 13 '11 19:07

Alagu


People also ask

What is the difference between trunk and branch in svn?

A trunk in SVN is main development area, where major development happens. A branch in SVN is sub development area where parallel development on different functionalities happens. After completion of a functionality, a branch is usually merged back into trunk.

What is a sync merge svn?

Sync merge is used when you want to fetch all of the latest changes made on your parent branch (e.g. trunk). Using this will keep your feature branch up-to-date with the parent branch.


2 Answers

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.

like image 168
Doug Chamberlain Avatar answered Sep 16 '22 14:09

Doug Chamberlain


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.

like image 42
Grammin Avatar answered Sep 19 '22 14:09

Grammin