Sunday, March 07, 2010

Local SVN for personal software programming

If you do programming as a hobby at home, it may be worth using a local svn for version control. It is quite easy to setup.
1) Install SVN server. If you are using Mac OS X and if you use macports, then 'port subversion' will do the magic
rejeev$port subversion
2) Create a repository.
svnadmin create /Users/rejeev/svnrepositories/myproject1
3) Checkout initial version.

cd /Users/rejeev/workspace

svn co file:////Users/rejeev/svnrepositories/myproject1

A directory 'myproject1' must be created this location.
4) Put your source code at this location. If you are using a maven, you can create a maven project at this location. Your directory structure will look like below.

pom.xml

src/main/java

src/main/resources

src/test/java

src/main/resources


5) Make the initial checkin

svn add pom.xml

svn add src

svn ci -m "initial checkin"

That is all!

Some advanced stuff
If you are working from multiple machines (office and home?) or multiple people are working on same stuff you can run a SVN server and access do checkin/checkout from multiple boxes
To start SVN server

svnserve -d -r /Users/rejeev/svnrepositories/myproject1

To checkout code from a different machine

cd /Users/rejeev/work

svn co svn://mymachine-name myproject1

No comments: