You’ve now seen some examples of the svn merge command, and you’re about to see several more. If you’re feeling confused about exactly how merging works, you’re not alone. Many users (especially those new to version control) are initially perplexed about the proper syntax of the command and about how and when the feature should be used. But fear not, this command is actually much simpler than you think! There’s a very easy technique for understanding exactly how svn merge behaves.
The main source of confusion is the name of the command. The term “merge” somehow denotes that branches are combined together, or that some sort of mysterious blending of data is going on. That’s not the case. A better name for the command might have been svn diff-and-apply, because that’s all that happens: two repository trees are compared, and the differences are applied to a working copy.
If you’re using svn merge to do basic copying of changes between branches, it will generally do the right thing automatically. For example, a command such as the following:
$ svn merge http://svn.example.com/repos/calc/some-branch
will attempt to duplicate any changes made on some-branch into your current working directory, which is presumably a working copy that shares some historical connection to the branch. The command is smart enough to duplicate only changes that your working copy doesn’t yet have. If you repeat this command once a week, it will duplicate only the “newest” branch changes ...