The Linux Page

svn merge, How does it work?

Whenever I try to merge, which does not happen very often, with the SVN source control system (i.e. Subversion), I have to test 20 different ways before I finally find the right way.

Now, I'm writing the solution that works for me.

The command I have to use is:

svn merge -r N:M file:///path/to/svn/file /destination/path

The path to the SVN file is the same as what you would use to check out that specific folder (file).

The destination path is where you want the merge to be applied.

The N and M values represent the from and to revision to merge from the source to the destination.

Say you look at your logs with:

svn log file:///path/to/svn/file

and define the smallest number and largest number of the data you want to merge from the source to the destination. For instance, if you created the source branch at revision 46 and worked on it up to revision 121, then you would use -r 46:121 to merge all of these changes to your destination branch.

Since it merges using patch & diff, the result is similar to a merge when two people change the same file.