<?xml version="1.0" encoding="utf-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Summary</title> <link rel="stylesheet" type="text/css" href="styles.css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /> <style type="text/css"> body { background-image: url('images/draft.png'); background-repeat: no-repeat; background-position: top left; /* The following properties make the watermark "fixed" on the page. */ /* I think that's just a bit too distracting for the reader... */ /* background-attachment: fixed; */ /* background-position: center center; */ }</style> <link rel="home" href="index.html" title="Version Control with Subversion [DRAFT]" /> <link rel="up" href="svn.branchmerge.html" title="Chapter 4. Branching and Merging" /> <link rel="prev" href="svn.branchmerge.when.html" title="To Branch or Not to Branch?" /> <link rel="next" href="svn.reposadmin.html" title="Chapter 5. Repository Administration" /> </head> <body> <div xmlns="" id="vcws-version-notice"> <p>This text is a work in progress—highly subject to change—and may not accurately describe any released version of the Apache™ Subversion® software. Bookmarking or otherwise referring others to this page is probably not such a smart idea. Please visit <a href="http://www.svnbook.com/">http://www.svnbook.com/</a> for stable versions of this book.</p> </div> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">Summary</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="svn.branchmerge.when.html">Prev</a> </td> <th width="60%" align="center">Chapter 4. Branching and Merging</th> <td width="20%" align="right"> <a accesskey="n" href="svn.reposadmin.html">Next</a></td> </tr> </table> <hr /> </div> <div class="sect1" title="Summary"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"><a id="svn.branchmerge.summary"></a>Summary</h2> </div> </div> </div> <p>We covered a lot of ground in this chapter. We discussed the concepts of tags and branches and demonstrated how Subversion implements these concepts by copying directories with the <span class="command"><strong>svn copy</strong></span> command. We showed how to use <span class="command"><strong>svn merge</strong></span> to copy changes from one branch to another or roll back bad changes. We went over the use of <span class="command"><strong>svn switch</strong></span> to create mixed-location working copies. And we talked about how one might manage the organization and lifetimes of branches in a repository.</p> <p>Remember the Subversion mantra: branches and tags are cheap. So don't be afraid to use them when needed!</p> <p>As a helpful reminder of all the operations we discussed, here is handy reference table you can consult as you begin to make use of branches.</p> <div class="table"> <a id="svn.branchmerge.summary.tbl-1"></a> <p class="title"> <strong>Table 4.1. Branching and merging commands</strong> </p> <div class="table-contents"> <table summary="Branching and merging commands" border="1"> <colgroup> <col /> <col /> </colgroup> <thead> <tr> <th>Action</th> <th>Command</th> </tr> </thead> <tbody> <tr> <td>Create a branch or tag</td> <td> <strong class="userinput"> <code>svn copy <em class="replaceable"><code>URL1</code></em> <em class="replaceable"><code>URL2</code></em></code> </strong> </td> </tr> <tr> <td>Switch a working copy to a branch or tag</td> <td> <strong class="userinput"> <code>svn switch <em class="replaceable"><code>URL</code></em></code> </strong> </td> </tr> <tr> <td>Synchronize a branch with trunk</td> <td> <strong class="userinput"> <code>svn merge <em class="replaceable"><code>trunkURL</code></em>; svn commit</code> </strong> </td> </tr> <tr> <td>See merge history or eligible changesets</td> <td> <strong class="userinput"> <code>svn mergeinfo <em class="replaceable"><code>SOURCE</code></em> <em class="replaceable"><code>TARGET</code></em></code> </strong> </td> </tr> <tr> <td>Merge a branch back into trunk</td> <td> <strong class="userinput"> <code>svn merge <em class="replaceable"><code>branchURL</code></em>; svn commit</code> </strong> </td> </tr> <tr> <td>Merge one specific change</td> <td> <strong class="userinput"> <code>svn merge -c <em class="replaceable"><code>REV</code></em> <em class="replaceable"><code>URL</code></em>; svn commit</code> </strong> </td> </tr> <tr> <td>Merge a range of changes</td> <td> <strong class="userinput"> <code>svn merge -r <em class="replaceable"><code>REV1</code></em>:<em class="replaceable"><code>REV2</code></em> <em class="replaceable"><code>URL</code></em>; svn commit</code> </strong> </td> </tr> <tr> <td>Block a change from automatic merging</td> <td> <strong class="userinput"> <code>svn merge -c <em class="replaceable"><code>REV</code></em> --record-only <em class="replaceable"><code>URL</code></em>; svn commit</code> </strong> </td> </tr> <tr> <td>Preview a merge</td> <td> <strong class="userinput"> <code>svn merge <em class="replaceable"><code>URL</code></em> --dry-run</code> </strong> </td> </tr> <tr> <td>Abandon merge results</td> <td> <strong class="userinput"> <code>svn revert -R .</code> </strong> </td> </tr> <tr> <td>Resurrect something from history</td> <td> <strong class="userinput"> <code>svn copy <em class="replaceable"><code>URL</code></em>@<em class="replaceable"><code>REV</code></em> <em class="replaceable"><code>localPATH</code></em></code> </strong> </td> </tr> <tr> <td>Undo a committed change</td> <td> <strong class="userinput"> <code>svn merge -c -<em class="replaceable"><code>REV</code></em> <em class="replaceable"><code>URL</code></em>; svn commit</code> </strong> </td> </tr> <tr> <td>Examine merge-sensitive history</td> <td> <strong class="userinput"> <code>svn log -g; svn blame -g</code> </strong> </td> </tr> <tr> <td>Create a tag from a working copy</td> <td> <strong class="userinput"> <code>svn copy . <em class="replaceable"><code>tagURL</code></em></code> </strong> </td> </tr> <tr> <td>Rearrange a branch or tag</td> <td> <strong class="userinput"> <code>svn move <em class="replaceable"><code>URL1</code></em> <em class="replaceable"><code>URL2</code></em></code> </strong> </td> </tr> <tr> <td>Remove a branch or tag</td> <td> <strong class="userinput"> <code>svn delete <em class="replaceable"><code>URL</code></em></code> </strong> </td> </tr> </tbody> </table> </div> </div> <br class="table-break" /> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="svn.branchmerge.when.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="svn.branchmerge.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="svn.reposadmin.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">To Branch or Not to Branch? </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> Chapter 5. Repository Administration</td> </tr> </table> </div> <div xmlns="" id="vcws-footer"> <hr /> <img src="images/cc-by.png" style="float: right;" /> <p>You are reading <em>Version Control with Subversion</em> (for Subversion 1.8), by Ben Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato.</p> <p>This work is licensed under the <a href="http://creativecommons.org/licenses/by/2.0/">Creative Commons Attribution License v2.0</a>.</p> <p>To submit comments, corrections, or other contributions to the text, please visit <a href="http://www.svnbook.com/">http://www.svnbook.com/</a>.</p> </div> </body> </html>