Wednesday, February 20, 2013

How to Create a Local SVN Repository

Apache Subversion (SVN) is a software versioning and revision control system which is widely used in software industry. SVN is very useful when we create important and huge code over a time period. Because,    whatever change happened, we can go back to  our previous versions of the code. And other important feature is we can mange our huge source code with a huge development team. Normally, we install SVN in a server machine.

But we can create an SVN repository in our own computer and we can mange our code locally. It is very simple and there are only few steps to complete.

First You have to install SVN in your computer. Here you can find the way to install. After installing, type the following command in the command line consecutively. This example is based on Linux OS.

mkdir /home/user/svndir  - This will create a directory called 'svndir'.

cd /home/user/svndir -  Go inside that directory.

svnadmin create mylocalrepo - 'mylocalrepo' is the name of your repository.

svn mkdir file:///home/user/svndir/mylocalrepo/myproject  - You create a directory called 'myproject' inside your repository.

svn import /home/user/HelloWorld file:///home/user/svndir/mylocalrepo/myproject - You enter your 'HelloWorld' porject in to the local repository 'myproject' directory.

Now you are done..!

You can check your local repository content by executing following command. 
svn list --verbose file:///home/user/svndir/mylocalrepo

You can use all the SVN command which has been listed here
As an example, when you want to check out your project to your workspace type following command.
svn co file:///home/user/svndir/mylocalrepo/myproject /home/user/workspace