|Ned Batchelder : Blog | Code | Text | Site|
Subversion on Windows quick start
» Home : Text
Created 5 February 2005, last updated 30 August 2005
I have a number of personal projects that I store in the Subversion version control system. This is my cheat sheet for how to create a new Subversion repository for a project.
These instructions will be most useful to you if you have the same work style as me: projects that only have one developer, the Subversion repository is on the same machine accessed as a file, you run on Windows, and you like using the command-line. If you have other needs, maybe you can adjust these instructions, maybe not.
Before putting your project in Subversion, you should prepare the project a bit first.
Now we're ready to put the project into Subversion. Here's what you do:
Congratulations, you've created a Subversion repository containing your project.
Now your files are stored in Subversion, but there is no Subversion-aware copy of the files for you to work on. Make that copy by checking out your project from Subversion. You can't checkout over your original files because Subversion will complain that an object of the same name already exists. Either delete your original files (you backed them up, right?), or checkout to a new directory:
Now you have your project back where it started, but under Subversion control.
Usually, there are files in your project directory that you don't want stored in Subversion. These were files you may have cleaned up above. For example, Python produces compiled .pyc files. You can instruct Subversion to ignore these files, so that you don't accidentally store them in your repository. Subversion can store properties on files and directories as well as the contents. You tell Subversion which files to ignore by setting the svn:ignore property on directories.
Now you work on your project. You can change files without checking them out first. The files are writable, and Subversion has its own copy so it can tell what has changed.
To add a new file to your project, create the file, then tell Subversion about it with the add command:
See what you've changed with the status (or st for short) command:
Changes get committed back to the repository with the commit (or ci) command:
Files can be deleted with the remove (or rm) command, and moved or renamed with the move (mv) command:
Remember that nothing really happens in the repository until you commit:
Occasionally, you should pull changes from the repository. Use the update (or up) command to do this:
Even though you are the only one working on the project, your working copy isn't really at the latest revision until you update it from the repository. For example, the "svn log" command shows the history of changes, but only up to your latest "svn update" revision.
That's all there is to it: now go be productive!