Quick SVN merging guide

Calling svn merge
The basic usage for svn merge is: svn merge what from to Where  and   are the paths of the source and destination files or directories (  has to be a file system path,   can be either a file system path or a URL), and   indicates which revision(s) to merge (more about that below). If  is not specified, it defaults to   (current directory) if   is a directory or to the base name of   if it's a file.

There are more usage modes than the ones covered here; run  to learn everything you never wanted to know about.

Merging individual revisions
To merge an individual revision, use. Example: catrope@roanLaptop:~/mediawiki/branches/wmf/1.16wmf4$ svn merge -c 76077 ../../../trunk/phase3/includes/api/ includes/api/ --- Merging r76077 into 'includes/api/ApiLogin.php': U   includes/api/ApiLogin.php

Merging ranges of revisions
To merge a range of revisions, use  where   and   are revision IDs. This will merge all revisions starting at  up to but not including. This means that, for instance,  is a useless empty range,   is a range containing one revision (r76077) and   is equivalent to.

Reverting (ranges of) revisions
To revert (SVN lingo: reverse-merge) a range, simply swap the start and end revisions, e.g.  to revert. To revert a single revision, use a negative revision ID, e.g.  to revert r76077 (this is equivalent to  ).

Conflicts
In its interaction with the user,  is very similar to   in that it outputs file names with status markers (Updated, Added, Deleted, Conflicted, ...) and asks the user what to do when it encounters a conflict. Merge conflicts are presented and resolved just like normal conflicts thrown by.

Tips and tricks
Although the basics are fairly simple, merging is a true art (or the seventh circle of hell, depending on who you ask) in complex cases. I can provide some tips to help you along, but experience and a good understanding of SVN merging is all but required for complex merges.
 * Have a clean working copy when you start. A failed merge can make it very hard to get your original changes back
 * When something goes wrong, consider using to undo your changes and start over
 * When doing multi-step merges, it may be wise to back up your tree (or the diff) between steps so you can go back to the previous state easily
 * When you get a conflict, don't panic right away, but try to at least look at the conflict; many conflicts are trivial
 * SVN allows you to postpone a conflict, leaving the conflict markers for you to resolve later, and in some cases does this automatically. Files marked as conflicted show up with a C in, and SVN will refuse to commit such files. Use   to mark a conflicted file as resolved
 * There are multiple ways in which you can accidentally mark a file that still contains conflict markers as resolved. Before committing a merge, check your diff (as you should for every commit anyway) and keep an eye out for conflict markers. Conflict markers are,   and