English 中文(简体)
Problem in SVN merging branches into trunk
原标题:

I have a trunk (A) and two branches (B and C). When I merge A with C its OK, after I merge A with B, the previous C its overwriten and my trunk don t have the C changes.

What I want is A + B + C into trunk after merges.

Edited for more explanation:

  1. In trunk I have 3 files: "FILE 1", "FILE 2" and "FILE 3";
  2. I create a branch from trunk as "Branch 1";
  3. I switch to "Branch 1", I fix bugs into "FILE 1" file and commit;
  4. In the same time, another person create a branch from trunk as "Branch 2";
  5. This person fix another bugs into "FILE 2" and "FILE 3" files and commit;
  6. The "Branch 2" is approved for publish, then I merge "Branch 2" to "trunk" (its ok);
  7. In next day the "Branch 1" is approved, then I merge "Branch 1" to "trunk", and the "trunk" lose the changes from "Branch 2".
最佳回答
  1. Make a working copy of trunk
  2. svn merge -r W:X svn://branchA workingCopy
  3. svn merge -r Y:Z svn://branchB workingCopy

I think this will give you what you want, which is the trunk plus any changes made by either branch. You will have to deal with conflicts, however.

问题回答

Assuming you re using Subversion 1.5 or greater, I think you want to "reintegrate" your branches back to the trunk, see http://blog.red-bean.com/sussman/?p=92

Your terminology is not clear. When you say you "merge A with B" does that mean you merge A into B or B into A? Can you explain exactly what you did to create the branches, and how you attempted to do the merging? Also, for merging it s important which SVN version you re using.

I suggest you carefully read the chapter on branching and merging in the SVN book.

Basically, when you have a feature branch (which is what you seem to have), you repeatedly merge the branch into it. SVN then logs which revisions you merged and won t merge them again. When you re done with your branch, you reintegrate it into the trunk and dismiss it.

All this is done on your disk, one branch at a time, resolving potential conflicts after each branch, and checking in each step. (If for some reason you need to apply the changes to the trunk in one checkin, you can merge your branches into a fresh branch off the trunk and then merge that branch into the trunk when you re done.)





相关问题
Best practices for Subversion and Visual Studio projects

I ve recently started working on various C# projects in Visual Studio as part of a plan for a large scale system that will be used to replace our current system that s built from a cobbling-together ...

Changing username in SVN+SSH URI on the fly in working copy

I am using SVN+SSH to check out a working copy of repository from an SVN server on which all developers are members of a developer group and have full read/write permissions on the repository ...

ASP.NET MVC: How should it work with subversion?

So, I have an asp.net mvc app that is being worked on by multiple developers in differing capacities. This is our first time working on a mvc app and my first time working with .NET. Our app does not ...

How to search for file in subversion server?

Is there a way to search for a file in a subversion repository? Something similar to Unix find command, with which I can find the location of a file in a repository. I know there is svn list, but ...

热门标签