Subversion is a nice open-source replacement for CVS which is the grand daddy of open source version control. Subversion fixes some of CVS's problems and is a very nice package for the price (free). I have stopped using Visual Source Safe in favor of Subversion and I believe that Subversion also beats ClearCase in ease of use and maintainability.
I have created a quick tutorial for getting SVN up and running. This should not be a substitute for reading the manual.
SVN New Repository Setup
1. Download and install SVN and Tortoise SVN. Currently at http://subversion.tigris.org/ and http://tortoisesvn.tigris.org/ respectively.
2. Decide on a repository layout.
I prefer this layout format:
/ /project /trunk /branches /tags
This layout allows us to have multiple projects in the repository organized by project which is the most convenient organization method by my way of thinking but you may come up with your own as Subversion does not force you to use a certain layout. A layout can also be changed at a later date unlike CVS.
3. Once you have a layout it's time to create a repository.
a. Open a command line
b. run this command: C:\>svnadmin create --fs-type fsfs c:\svn
This creates a new repository at c:\svn. It is in FSFS format as opposed to the default Berkely Database format.
The FSFS format appears to be a much better choice in almost all situations but you can consult the documentation for more info.
c. There will be many files and directories inside the repository but you will not and should not edit these directly.
4. Now that we have a repository let's implement that layout format we decided on in step 2.
The easiest way to create a file format is to create a temp directory and set up the structure in that temp directory and then import that into the repository.
a. In windows open a command prompt and do the following:
(this can be done in windows explorer also)
C:\>mkdir tmpdir
C:\>cd tmpdir
C:\tmpdir>mkdir yourproject
C:\tmpdir>mkdir yourproject\trunk
C:\tmpdir>mkdir yourproject\branches
C:\tmpdir>mkdir yourproject\tags
b. Now import this structure into our repository:
C:\tmpdir>svn import . file:///c:/svn --message "initial repository layout"
(Pay attention to the forward slashes as they are important, svn is not as forgiving as Windows in the forward/back slash department)
c. Now we can view our repository structure:
C:\>svn list --verbose file:///c:/svn/yourproject
5. Now we will either begin work on a new project or check in an existing project.
a. If we have an existing project we can import it using this command:
C:\>svn import c:\pathtoprojectfile file:///c:/svn/yourproject/trunk -m "initial import"
The syntax of the command is svn import pathofprojecttoimport urltorepository -m "message to label this version with"
Notice that we are importing our project into the trunk folder. This trunk folder is our main line of development.
6. We want to export a working copy of our project so that we can begin to work on it.
Here is the command:
C:\>svn checkout urltorepository pathtoworkingproject
Notice that this is the opposite of import command.
This is a good place to mention that when you have an existing project you want to add to source control you should probably move your original source to another directory then clean out all the unnecessary files, binaries or otherwise, that should not be added to source control, this is anything that can be built or generated. Once you have cleaned up your files and import the project, you will want to choose the place where you want to work with the project, which might be the same place you imported it from in the first place, so you may want to make a backup of your current working directory because you will need to do a checkout into an empty directory. Once you have completed the checkout into the empty working directory you can add back any libraries or other binaries (dll's, pictures, etc) that you did not originally add to source control.
Binaries of any type that will not be changing but need to be saved should probably be archived in some manner, you may choose to add it to your version control system for convenience or simply store these in another directory that will be backed up but not version controlled.
7. Now that we've made our changes we need to commit these changes to the repository.
change path to the directory of your working project
C:\>cd \pathtoworkingproject
C:\>svn commit -m "checkin comments"
This completes our command line walk though of SVN. If you are not a fan of the command line all of this can be done using TortoiseSVN. I will cover this in another tutorial.