Need Advice on Merging Code

If you are having a problem using Fortress, post a message here.

Moderator: SourceGear

Post Reply
AjarnMark
Posts: 60
Joined: Mon Oct 29, 2007 4:22 pm
Location: Seattle, WA

Need Advice on Merging Code

Post by AjarnMark » Fri Mar 06, 2009 12:15 pm

We are on Fortress 1.0.6.15954.

I have three active legs of code and could really use some advice on how to pull this all back together. Here's the history:
  • We were developing in TRUNK and got to the point where we were cutting a release.
  • We made a branch named 6.0 from the TRUNK to be used for any support maintenance coding, and there was some.
  • Development continued in TRUNK toward the next release. Nearing the cutoff, we created a new branch (7.0) from TRUNK.
  • Development continued in TRUNK toward the next release (8.0).
  • However, due to a variety of factors, 7.0 did not actually get released, so the PROD version is still 6.0.
  • Additional coding was done in the 6.0 branch to support PROD maintenance.
  • Additional coding was also done in the 7.0 branch to support QA and UAT, as well as a couple of new features.
So, what is the best method to use in order to get the changes that were made in the 6.0 branch into both the 7.0 branch and TRUNK? Should I merge from branch to branch? At this point do I merge the changes from 6.0 back into TRUNK or do I just merge from 6.0 branch to 7.0 branch and then merge from 7.0 branch back to TRUNK? Or should I avoid using merge between branches and just do some DIFF comparisons and manually edit the 7.0 branch to account for the changes from 6.0?

And while we're on the topic, is there something I should have done differently that would be a more appopriate way of dealing with code management?

Thanks for sharing your wisdom!

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Need Advice on Merging Code

Post by lbauer » Fri Mar 06, 2009 4:43 pm

You can merge branch to trunk, trunk to branch, or branch to branch, so you have a number of options. You may want to be somewhat methodical here, so things don't get too confused. So you could merge 6.0 into 7.0 and then 7.0 into 8.0. That's just one option.

Whatever you decide, plan out the steps ahead of time so all the changes get applied to the proper folders.
Linda Bauer
SourceGear
Technical Support Manager

AjarnMark
Posts: 60
Joined: Mon Oct 29, 2007 4:22 pm
Location: Seattle, WA

Re: Need Advice on Merging Code

Post by AjarnMark » Fri Mar 06, 2009 5:28 pm

Thanks, Linda,for the response. It sounds from the way you worded it, that all of those approaches (branch-branch, trunk-branch, etc.) are equal. Is that true, or is there one that works better with the merge tool than the others?

I just want to double-check because I have had some troubles in the past doing branch-branch, but I suspect that was partly my own mistakes, and partly due to how far back in history the common ancestor was.

So, given the parentage I've described in my origninal post, is there any approach that would likely meet with greater success by automation? I will definitely review all the results to verify, but if one approach makes the tool's job easier/more accurate, then I want to put the odds in my favor as much as possible.

kayanat
Posts: 1
Joined: Fri Mar 06, 2009 4:38 am

Re: Need Advice on Merging Code

Post by kayanat » Sat Mar 07, 2009 10:38 pm

thank you lbauer. Just like AjarnMark I was also going through same problem. But now after reading this thread it has been solved.

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Need Advice on Merging Code

Post by lbauer » Mon Mar 09, 2009 9:03 am

I have had some troubles in the past doing branch-branch, but I suspect that was partly my own mistakes, and partly due to how far back in history the common ancestor was.
Yes, if the branches (or even trunk-branch) diverge to far from the common ancestor, the merge will be more of a challenge for the merge tool.

However, the merge tool should work equally well on merging branch-to-branch or branch-to-trunk. One thing to avoid, is merging changes that have already been applied in a previous merge. So you may want to keep a list of what changes have already been applied to the merge target.
Linda Bauer
SourceGear
Technical Support Manager

AjarnMark
Posts: 60
Joined: Mon Oct 29, 2007 4:22 pm
Location: Seattle, WA

Re: Need Advice on Merging Code

Post by AjarnMark » Mon Mar 09, 2009 11:20 am

Thanks again, Linda!

And regarding:
lbauer wrote:One thing to avoid, is merging changes that have already been applied in a previous merge. So you may want to keep a list of what changes have already been applied to the merge target.
This I definitely do. I ran into trouble one time in the beginning, I suspect because of this, and picked up this habit. I also started adding my own summary comments to the Merge Check-In comments to help me whenever I had to review.

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Need Advice on Merging Code

Post by lbauer » Tue Mar 10, 2009 3:41 pm

Let me know if you have additional questions.
Linda Bauer
SourceGear
Technical Support Manager

Post Reply