4.3 Creating a Working Copy
The working copy is where you make all of your changes to the files in the repository. You check out the working copy directory by running the svn checkout command, and it contacts the repository to retrieve a copy of the most recent revision of all the data in your repository. A local directory tree that matches the tree inside the repository will be created, and the downloaded working directory files will be placed in there.
$ svn checkout file:///home/bill/my_repository/trunk my_repos_trunk A my_repos_trunk/hello.c A my_repos_trunk/Makefile Checked out revision 1.
As you can see, Subversion has checked out the trunk directory from your repository, creating a local working copy directory with the name my_repos_trunk, along with the files hello.c and Makefile that were stored in trunk. You'll notice, however, that the branches and tags directories were not checked out. Subversion will let you check out the entire repository at the top level, but doing so is generally not good practice. If you do, you may end up with multiple local copies of the source tree, because branches and tags are made by copying files. Instead, if you only check out the main trunk, you will ensure that you only have one version of the files at a time in your working copy. If you need to access specific branches or tags, you can either check them out on an individual basis, into their own working copies, or switch files in your trunk working copy to point to other locations in the repository (e.g. branches or tags), which I'll show you how to do in a later section.
Now, if you look closely at your new working copy, you can see that Subversion also has placed one additional directory in the directory that you checked out.
$ ls my_repos_trunk Makefile hello.c $ ls -A my_repos_trunk .svn Makefile hello.c
When you check out a repository, Subversion places a .svn directory in every directory of the repository. Inside these directories, Subversion places a wide variety of metadata about the working directory, including what repository the working directory comes from and what revisions of each file have been checked out. It also stores complete pristine versions of the last checked-out revision of each file in the working directory. This allows Subversion to provide you with diffs showing what changes you have made locally to a file, without needing to contact the server.