Some people have trouble absorbing a new technology by reading the sort of top-down approach provided by this book. This section is a very short introduction to Subversion, and is designed to give bottom-up learners a fighting chance. If you're one of those folks who prefers to learn by experimentation, the following demonstration will get you up and running. Along the way, we give links to the relevant chapters of this book. If you're new to the entire concept of version control or to the copy-modify-merge model used by both CVS and Subversion, then you should read Chapter 2 before going any further.
Subversion stores all versioned data in a central repository. To begin, create a new repository: $ svnadmin create /path/to/repos $ ls /path/to/repos conf/ dav/ db/ format hooks/ locks/ README.txt This command creates a new directory /path/to/repos which contains a Subversion repository. Make sure that this directory lives on a local disk, not a network share. This new directory mainly contains a collection of Berkeley DB database files. You won't see your versioned files if you peek inside. For more information about repository creation and maintenance, see Chapter 5. Next, create a tree of files and directories to import into the repository. For reasons that will be clear later on (see Chapter 4), your structure should contain three top-level directories named branches, tags, and trunk: /tmp/project/branches/ /tmp/project/tags/ /tmp/project/trunk/ foo.c bar.c Makefile ... Once you have a tree of data ready to go, import the data into the repository with the svn import command (Section 3.7.2): $ svn import /tmp/project file:///path/to/repos -m "initial import" Adding /tmp/project/branches Adding /tmp/project/tags Adding /tmp/project/trunk Adding /tmp/project/trunk/foo.c Adding /tmp/project/trunk/bar.c Adding /tmp/project/trunk/Makefile ... Committed revision 1. $ Now the repository contains your tree of data. At this point, you create a working copy of the trunk directory. This is where your actual work will happen: $ svn checkout file://path/to/repos/trunk project A project/foo.c A project/bar.c A project/Makefile ... Checked out revision 1. Now you have a personal copy of part of the repository in a new directory named project. You can edit the files in your working copy and then commit those changes back into the repository:
For a full tour of all the things you can do with your working copy, read Chaper 3. At this point, you have the option of making your repository available to others over a network. See Chapter 6to learn about the different sorts of server processes available and how to configure them. |