<?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>svn copy</title><link rel="stylesheet" href="styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><link rel="start" href="index.html" title="Version Control with Subversion" /><link rel="up" href="svn.ref.svn.html#svn.ref.svn.c" title="svn Subcommands" /><link rel="prev" href="svn.ref.svn.c.commit.html" title="svn commit" /><link rel="next" href="svn.ref.svn.c.delete.html" title="svn delete" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">svn copy</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="svn.ref.svn.c.commit.html">Prev</a> </td><th width="60%" align="center"><span class="command"><strong>svn</strong></span> Subcommands</th><td width="20%" align="right"> <a accesskey="n" href="svn.ref.svn.c.delete.html">Next</a></td></tr></table><hr /></div><div class="refentry" lang="en" xml:lang="en"><a id="svn.ref.svn.c.copy"></a><div class="titlepage"></div><a id="id415775" class="indexterm"></a><div class="refnamediv"><h2>Name</h2><p>svn copy — Copy a file or directory in a working copy or in the repository.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="id415801"></a><h2>Synopsis</h2><pre class="programlisting">svn copy SRC[@REV]... DST</pre></div><div class="refsect1" lang="en" xml:lang="en"><a id="id415814"></a><h2>Description</h2><p>Copy one or more files in a working copy or in the repository. When copying multiple sources, they will be added as children of DST, which must be a directory. <em class="replaceable"><code>SRC</code></em> and <em class="replaceable"><code>DST</code></em> can each be either a working copy (WC) path or URL:</p><div class="variablelist"><dl><dt><span class="term">WC -> WC</span></dt><dd><p>Copy and schedule an item for addition (with history).</p></dd><dt><span class="term">WC -> URL</span></dt><dd><p>Immediately commit a copy of WC to URL.</p></dd><dt><span class="term">URL -> WC</span></dt><dd><p>Check out URL into WC, and schedule it for addition.</p></dd><dt><span class="term">URL -> URL</span></dt><dd><p>Complete server-side copy. This is usually used to branch and tag.</p></dd></dl></div><p>When copying multiple sources, they will be added as children of <em class="replaceable"><code>DST</code></em>, which must be a directory.</p><p>If no peg revision (ie <em class="replaceable"><code>@REV</code></em>) is supplied, by default the <code class="literal">BASE</code> revision will be used for files copied from the working copy, while the <code class="literal">HEAD</code> revision will be used for files copied from a URL.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>You can only copy files within a single repository. Subversion does not support cross-repository copying.</p></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="id415927"></a><h2>Alternate Names</h2><p>cp</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="id415937"></a><h2>Changes</h2><p>Repository if destination is a URL.</p><p>Working copy if destination is a WC path.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="id415951"></a><h2>Accesses Repository</h2><p>If source or destination is in the repository, or if needed to look up the source revision number.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="id415962"></a><h2>Options</h2><pre class="screen"> --message (-m) TEXT --file (-F) FILE --revision (-r) REV --quiet (-q) --parents --with-revprop ARG --username USER --password PASS --no-auth-cache --non-interactive --force-log --editor-cmd EDITOR --encoding ENC --config-dir DIR </pre></div><div class="refsect1" lang="en" xml:lang="en"><a id="id415976"></a><h2>Examples</h2><p>Copy an item within your working copy (just schedules the copy—nothing goes into the repository until you commit):</p><pre class="screen"> $ svn copy foo.txt bar.txt A bar.txt $ svn status A + bar.txt </pre><p>Copy several files in a working copy into a subdirectory:</p><pre class="screen"> $ svn cp bat.c baz.c qux.c src A src/bat.c A src/baz.c A src/qux.c </pre><p>Copy revision 8 of <code class="literal">bat.c</code> into your working copy under a different name:</p><pre class="screen"> $ svn cp bat.c ya-old-bat.c A ya-old-bat.c </pre><p>Copy an item in your working copy to a URL in the repository (an immediate commit, so you must supply a commit message):</p><pre class="screen"> $ svn copy near.txt file:///var/svn/repos/test/far-away.txt -m "Remote copy." Committed revision 8. </pre><p>Copy an item from the repository to your working copy (just schedules the copy—nothing goes into the repository until you commit):</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p>This is the recommended way to resurrect a dead file in your repository!</p></div><pre class="screen"> $ svn copy file:///var/svn/repos/test/far-away near-here A near-here </pre><p>And finally, copying between two URLs:</p><pre class="screen"> $ svn copy file:///var/svn/repos/test/far-away file:///var/svn/repos/test/over-there -m "remote copy." Committed revision 9. </pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p>This is the easiest way to “<span class="quote">tag</span>” a revision in your repository—just <span class="command"><strong>svn copy</strong></span> that revision (usually <code class="literal">HEAD</code>) into your tags directory.</p></div><pre class="screen"> $ svn copy file:///var/svn/repos/test/trunk file:///var/svn/repos/test/tags/0.6.32-prerelease -m "tag tree" Committed revision 12. </pre><p>And don't worry if you forgot to tag—you can always specify an older revision and tag anytime:</p><pre class="screen"> $ svn copy -r 11 file:///var/svn/repos/test/trunk file:///var/svn/repos/test/tags/0.6.32-prerelease -m "Forgot to tag at rev 11" Committed revision 13. </pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="svn.ref.svn.c.commit.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="svn.ref.svn.html#svn.ref.svn.c">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="svn.ref.svn.c.delete.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">svn commit </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> svn delete</td></tr></table></div></body></html>