tags:

views:

42

answers:

4

I have one main line and a branch. There are changes made on main line and also in branch. Now I need to make sure all the changes made on branch are moved to main line. Since there are changes made in main line as well, what is the best way to merge changes (from branch to main line)? Is there a way to see the difference of the two files (Main to branch) and then do the merge?

I'm using Tortoise SVN.

Thanks

A: 

SVN will create merge conflicts which you can then resolve with a merge tool of your choice (on Windows e.g. WinMerge). It'll show you changes that were made in both files. You usually need to merge them manually (with the help of the merge tool). Once you finished merging you commit the merged files into trunk.

halfdan
A: 

If you right-click on a folder and choose Merge, you can choose to Reintegrate a branch, or to Merge two different trees, which may be more what you're looking for.

JamesMLV
A: 

Probably the best and the most reliable option is to merge branch and main manually with the help of external tool (for example BeyondCompare).

Pmod
I like BeyondCompare very much and I use it to double-check after merging. But I think that the right way to do this is to use svn tools: 1. merge from branch to trunk in clean an updated working copy, 2. review and solve conflicts in wc (I recommend using kDiff for this), 3. commit
tato
+1  A: 

Do a merge with Tortoise, from the branch into the mainline, and unless there are conflicts (contrary changes very close to each other), it'll handle it. The repo hasn't changed yet, it's just a local merge. So now you commit the changes. Preview the commit to see what you're actually changing. If you like it, great. Now do the same from the mainline into the branch. Now you should be in sync. If you have conflicts, you'll have to edit the conflict (right within tortoise) to pick and choose which lines you want.

Chris Thornton
can we merge file to file bases instead of whole branch or tag?
Sheraz Khan
I merge at the branch level, but usually just merge the "range of revisions". That brings up a log, where you pick the revisions that you want to merge.
Chris Thornton
the key point here is that the merge is done in a working copy. It is very important that the working copy you use is absolutely clean (no changes) and updated. In this way, after you do the merge and before you commit, you have a very clear picture of what changes came from branch to trunk.
tato
To extend the comment from @tato, it is a good idea to checkout a clean working copy for the merge target, and do the merge in this dedicated working copy.
Rudi