kenpeter
kenpeter

Reputation: 8294

How to svn merge two branches in command line

I checkout other people's branch. Inside, I do

   svn merge http://repo.com/apps/service/branches/my_branch http://repo.com/apps/service/branches/your_branch

What is the correct way to do svn merge in cli? The command above gives

Merging differences between repository URLs into '.':
 G   .
Recording mergeinfo for merge between repository URLs into '.':
 U   .

when I do svn commit -m "xxx". It seems nothing happened. What is the correct to merge 1 branch?

Upvotes: 1

Views: 5117

Answers (1)

Peter Parker
Peter Parker

Reputation: 29735

I expect you want to merge changes from your_branch into my_branch? please update your question accordingly, it is not clear what you want to merge from where.

You need to have a checked out working copy to merge into. Also I expect it is your current directory as otherwise the merge command fails. However, it is not clear to which SVN branch this Workingcopy points so please state this as well. I expect this is my_branch in your case.

You performed a "2-URL merge" which is: showing you the difference between my_branch and your_branch and merge them into working copy (my_branch). In the result it will be the same as your_branch undoing all changes done on my_branch (my_branch+ [your_branch-my_branch] = your_branch).

What you usually want is a "complete merge". Just state the branch you want to merge from and the changes will be applied to your working copy:

svn merge http://repo.com/apps/service/branches/your_branch

This will show up all changes from your_branch in my_branch

To complete the list: the 3rd merge is "cherry-pick merge" and looks like "complete merge" but selects certain revisions to merge.

Upvotes: 2

Related Questions