<?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>Getting Data into your Repository</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.tour.html" title="Chapter 2. Basic Usage" /><link rel="prev" href="svn.tour.help.html" title="Help!" /><link rel="next" href="svn.tour.initial.html" title="Initial Checkout" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Getting Data into your Repository</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="svn.tour.help.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Basic Usage</th><td width="20%" align="right"> <a accesskey="n" href="svn.tour.initial.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="svn.tour.importing"></a>Getting Data into your Repository</h2></div></div></div><p>There are two ways to get new files into your Subversion repository: <span class="command"><strong>svn import</strong></span> and <span class="command"><strong>svn add</strong></span>. We'll discuss <span class="command"><strong>svn import</strong></span> here and <span class="command"><strong>svn add</strong></span> later in this chapter when we review a typical day with Subversion.</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="svn.tour.importing.import"></a>svn import</h3></div></div></div><p>The <span class="command"><strong>svn import</strong></span> command is a quick way to copy an unversioned tree of files into a repository, creating intermediate directories as necessary. <span class="command"><strong>svn import</strong></span> doesn't require a working copy, and your files are immediately committed to the repository. This is typically used when you have an existing tree of files that you want to begin tracking in your Subversion repository. For example:</p><pre class="screen"> $ svnadmin create /var/svn/newrepos $ svn import mytree file:///var/svn/newrepos/some/project \ -m "Initial import" Adding mytree/foo.c Adding mytree/bar.c Adding mytree/subdir Adding mytree/subdir/quux.h Committed revision 1. </pre><p>The previous example copied the contents of directory <code class="filename">mytree</code> under the directory <code class="filename">some/project</code> in the repository:</p><pre class="screen"> $ svn list file:///var/svn/newrepos/some/project bar.c foo.c subdir/ </pre><p>Note that after the import is finished, the original tree is <span class="emphasis"><em>not</em></span> converted into a working copy. To start working, you still need to <span class="command"><strong>svn checkout</strong></span> a fresh working copy of the tree.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="svn.tour.importing.layout"></a>Recommended repository layout</h3></div></div></div><p>While Subversion's flexibility allows you to layout your repository in any way that you choose, we recommend that you create a <code class="filename">trunk</code> directory to hold the “<span class="quote">main line</span>” of development, a <code class="filename">branches</code> directory to contain branch copies, and a <code class="filename">tags</code> directory to contain tag copies, for example:</p><pre class="screen"> $ svn list file:///var/svn/repos /trunk /branches /tags </pre><p>You'll learn more about tags and branches in <a class="xref" href="svn.branchmerge.html" title="Chapter 4. Branching and Merging">Chapter 4, <i>Branching and Merging</i></a>. For details and how to set up multiple projects, see <a class="xref" href="svn.branchmerge.maint.html#svn.branchmerge.maint.layout" title="Repository Layout">the section called “Repository Layout”</a> and <a class="xref" href="svn.reposadmin.planning.html#svn.reposadmin.projects.chooselayout" title="Planning Your Repository Organization">the section called “Planning Your Repository Organization”</a> to read more about “<span class="quote">project roots</span>”.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="svn.tour.help.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="svn.tour.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="svn.tour.initial.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Help! </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Initial Checkout</td></tr></table></div></body></html>