SVN Merging Two Branches

Hill, Paul PHill at cdgnow.com
Thu Nov 29 13:10:54 CST 2007


I am a "New User" as in:

"But which two trees should be compared? At first glance, the answer may
seem obvious: just
compare the latest trunk tree with your latest branch tree. But beware-this
assumption is wrong,
and has burned many a new user!"

I'm trying to get my head around this whole merging thing.

The above quote goes on to say

"Since svn merge operates like svn diff, comparing the
latest trunk and branch trees will not merely describe the set of changes
you made to your branch. Such a comparison shows too many changes: it would
not only show the addition of your branch changes, but also the removal  of
trunk changes that never happened on your branch."
--
http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.branchmerge.commonuses.
wholebr

It took me a while to come to any understanding of that last sentence.
Because of this, I might suggest some explanation of why I don't want both
branches changes.

"Since the trunk already has these changes, you don't need to include them
in this merge."

OK, one suggestion, now one typo question:

In order to find the complete list of changes for the branch, the book uses

$ cd calc/trunk
$ svn update
At revision 405.

Isn't this wrong in the case where the _branch_ has been updated later than
the trunk, because we want _all_ of the changes on the branch, and if the
_branch_ is up to 410 we don't want just from the base which is 341, through
405, we want 341 through 410.

Am I right?

Thus we need to ask about where the branch is:
$ cd branches/my-calc-branch
$ svn update
At revision 410
            ***
And then dropping back over to the target trunk we can attempt a merge
$ cd calc/trunk
$ svn update
At revision 405.
            ***
$ svn merge -r 341:410
http://svn.example.com/repos/calc/branches/my-calc-branch
                   ***
Am I still right?

Also, could I not also do:

$ svn merge -r 341:HEAD
http://svn.example.com/repos/calc/branches/my-calc-branch
                   ****

Give me some tough love on this and show me where my logic is pathetically
flawed.

Sincerely,
-Paul






More information about the svnbook-dev mailing list