svn merge — Apply the differences between two sources to a working copy path.
svn merge [-c M | -r N:M] SOURCE[@REV] [WCPATH]
svn merge sourceURL1[@N] sourceURL2[@M] [WCPATH]
svn merge sourceWCPATH1@N sourceWCPATH2@M [WCPATH]
In the first and second forms, the source paths (URLs
in the first form, working copy paths in the second) are
specified at revisions N
and
M
. These are the two sources
to be compared. The revisions default to
HEAD
if omitted.
The -c M
option is equivalent to
-r N:M
where N =
M-1
. Using -c -M
does
the reverse: -r M:N
where
N = M-1
.
In the third form, SOURCE
can be a URL or working copy item, in which case the
corresponding URL is used. This URL, at revisions
N
and
M
, defines the two sources to
be compared.
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.
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 --non-recursive (-N) --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:///tmp/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