svn merge — Apply the differences between two sources to a working copy path.
svn merge sourceURL1[@N] sourceURL2[@M] [WCPATH]
svn merge sourceWCPATH1@N sourceWCPATH2@M [WCPATH]
svn merge [[-c M]... | [-r N:M]...] [SOURCE[@REV] [WCPATH]]
In the first form, the source URLs are specified at
These are the two sources to be compared. The revisions
HEAD if omitted.
In the second form, the URLs corresponding to the source working copy paths define the sources to be compared. The revisions must be specified.
In the third form,
can be either a URL or a working copy path (in which case
its corresponding URL is used). If not specified,
SOURCE will be the same as
SOURCE in revision
REV is compared as it existed
M for each revision range
REV is not
HEAD is assumed.
-c M is equivalent to
-c -M does
-r M:<M-1>. If no
revision ranges are specified, the default range of
1:HEAD is used. Multiple
instances may be specified, and mixing of forward and
reverse ranges is allowed—the ranges are internally
compacted to their minimum representation before merging
begins (which may result in no-op).
WCPATH is the working copy
path that will receive the changes. If
WCPATH is omitted, a default
value of “
.” is assumed,
unless the sources have identical basenames that match a
file within “
.”: in which
case, the differences will be applied to that file.
Subversion will only internally track metadata about the merge operation if the two sources are ancestrally related—if the first source is an ancestor of the second, or vice-versa. This is guaranteed to be the case when using the third form. Unlike svn diff, the merge command takes the ancestry of a file into consideration when performing a merge operation. This is very important when you're merging changes from one branch into another and you've renamed a file on one branch but not the other.
--revision (-r) REV --change (-c) REV --depth ARG --record-only --accept ARG --quiet (-q) --force --dry-run --diff3-cmd CMD --extensions (-x) ARG --ignore-ancestry --username USER --password PASS --no-auth-cache --non-interactive --config-dir DIR
Merge a branch back into the trunk (assuming that you have a working copy of the trunk, and that the branch was created in revision 250):
$ svn merge -r 250:HEAD http://svn.red-bean.com/repos/branches/my-branch U myproj/tiny.txt U myproj/thhgttg.txt U myproj/win.txt U myproj/flo.txt
If you branched at revision 23, and you want to merge changes on trunk into your branch, you could do this from inside the working copy of your branch:
$ svn merge -r 23:30 file:///var/svn/repos/trunk/vendors U myproj/thhgttg.txt …
To merge changes to a single file:
$ cd myproj $ svn merge -r 30:31 thhgttg.txt U thhgttg.txt