This tutorial will outline the simple workflow to create a SVN local repository. Of course you can get a free online repository from website like assembla. However for simplicity and first time, I will just create a repository on local machine.
If you do not have SVN installed on your machine, you can go and grab it here according to your OS.
1 2 3
Let’s start by creating a new repository. (Substitude user with your username or you can use ~/ to replace /home/user/)
1 2 3
svnadmin program is the repository administrator’s best friend. In this case, we used it to create a new Subversion repository, but this program can also be used to preform several maintenance operations.
The new created
alpha_project repository is empty. So let’s import some project into it. Let’s say we had some project in our
1 2 3
This command import our project in
/home/user/code into the repository. Notice that we store our data in another folder
trunk by following SVN repository layout convention.
Most projects have a recognizable “main line”, or trunk, of development; some branches, which are divergent copies of development lines; and some tags, which are named, stable snapshots of a particular line of development.
And normally here is what it looks like in a SVN single project.
1 2 3 4
This tutorial won’t talk much about tags and branches (It’s ok to not create these 2 files). And for the message inside double quotations after -m is called commit. Commit is a message to record who and when created the change and who committed it. You can think of it as a message to describe the changes.
Now we have our project in the repository, but we are not going to do our work there. Instead, we create another directory by checkout from it, and work on this directory.
1 2 3
This duplicate a working copy of the repository into
alpha_project_copy directory. We’ll do our work here. After we’ve done our work, we will commit these changes back to the repository.
1 2 3 4
Always commit your message with short and meaningful description. Let’s say if we have another collaborator who is doing this project together. She made some changes to the project and commit it to the repository. For instance, in this case a revision 3 is committed but our working copy remains revision 2. To update our working copy to the latest changes,
I concluded the basic workflow of SVN in this tutorial. There are still a lot SVN can do.