Create Subversion repository on Windows
I have a number of personal projects that I store inthe Subversion version control system.
This is my cheat sheet for how to create a new Subversion repository for a project.
hese instructions will be most useful to you if you have the same work style as me: projects that only have one developer, the Subversion repositoryis 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.
- You have Subversion installed, with the binaries on your path.
- You have a tree of project files in a directory called ‘c:myproj’.
Before putting your project in Subversion, you should prepare the project a bit first.
- Backup your project files in case something goes wrong.
- Delete files that you don’t need, either because they are obsolete, or because they are generated files. For example, editor backup files, compiled binary files, or junk you just don’t want anymore.
Now we’re ready to put the project into Subversion. Here’s what you do:
- If you’ve never created a local Subversion repository, choose a place to put it, and make the directory:
$ mkdir c:svn
- Create a Subversion repository, using the Windows file path to the repository:
$ svnadmin create c:svnmyproj
- Import your existing project files into Subversion, using the URL address of the repository:
$ svn import c:myproj file:///c:/svn/myproj
An editor will pop open to collect a comment from you. This file indicates that just c:myproj is being added, but Subversion will pull in all of the contents of that directory too. Once you save the file, the existing files will be imported into your new repository.
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:
$ rmdir/s/q c:myproj
$ svn checkout file:///c:/svn/myproj c:myproj
Now you have your project back where it started, but under Subversion control.