3.4 Initial Checkout

Most of the time, you start using a Subversion repository by doing a checkout of your project. Checking out a repository creates a copy of it on your local machine. This copy contains the HEAD (latest revision) of the Subversion repository that you specify on the command line:

$ svn checkout http://svn.collab.net/repos/svn/trunk A  trunk/subversion.dsw A  trunk/svn_check.dsp A  trunk/COMMITTERS A  trunk/configure.in A  trunk/IDEAS ... Checked out revision 2499.

Repository Layout

If you're wondering what trunk is all about in the above URL, it's part of the way we recommend you lay out your Subversion repository, a topic we'll talk about a lot more in Chapter 4.


Although the previous example checks out the trunk directory, you can just as easily check out any deep subdirectory of a repository by specifying the subdirectory in the checkout URL:

$ svn checkout http://svn.collab.net/repos/svn/trunk/doc/book/tools A  tools/readme-dblite.html A  tools/fo-stylesheet.xsl A  tools/svnbook.el A  tools/dtd A  tools/dtd/dblite.dtd ... Checked out revision 3678.

Since Subversion uses a copy-modify-merge model instead of lock-modify-unlock (see Chapter 2), you're already able to start making changes to the files and directories in your working copy. Your working copy is just like any other collection of files and directories on your system. You can edit and change them, move them around, you can even delete the entire working copy and forget about it.

While your working copy is just like any other collection of files and directories on your system, you need to let Subversion know if you're going to be rearranging anything inside of your working copy. If you want to copy or move an item in a working copy, you should use svn copy or svn move instead of the copy and move commands provided by your operating system. We'll talk more about svn copy and svn move later in this chapter.


Unless you're ready to commit a new file or directory, or changes to existing ones, there's no need to further notify the Subversion server that you've done anything.

Every directory in a working copy contains an administrative area, a subdirectory named .svn. Usually, directory listing commands won't show this subdirectory, but it is nevertheless an important directory. Whatever you do, don't delete or change anything in the administrative area! Subversion depends on it to manage your working copy.


While you can certainly check out a working copy with the URL of the repository as the only argument, you can also specify a directory after your repository URL. This places your working copy into a new directory that you name. For example:

$ svn checkout http://svn.collab.net/repos/svn/trunk subv A  subv/subversion.dsw A  subv/svn_check.dsp A  subv/COMMITTERS A  subv/configure.in A  subv/IDEAS ... Checked out revision 2499.

That will place your working copy in a directory named subv instead of a directory named trunk, as we did previously.



Version Control with Subversion
Version Control with Subversion
ISBN: 0596510330
EAN: 2147483647
Year: 2003
Pages: 127

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net