Posted on 4th November 2009No Responses
SVN: A quick HOWTO

If you do a lot of coding, you will experience the need for versioning your code. I have used CVS before switching to and I can only recommend to you – once you get the hang of it, you will love it. I even use for keeping track of complex HTML templates.

When using for the first time, I followed a tutorial on the net but it was quite misleading and thus I had quite some trouble with checking in and out.

Let’s say we have an application that resides under /var/www/myApp/ and we have a repository over at www.mydomain.com//myAPP (you can create that via svnadmin create myAPP in the / directory).

OK, at first, we have to check out the empty repo to a directory (I use /home/joe/myAPP here):

co http://www.mydomain.com//myAPP /home/joe/myAPP

Then, we jump into our temporary repo and create the necessary directories:

cd /home/joe/myAPP
mkdir

Done? Good. Let’s copy our application to the / directory:

cp /var/www/myAPP -a

Now we can add our 3 folders to the repository (in fact, we only mark them for addition, they are added once we commit our changes by checking in):

add

, and directories are now registered as part of our repo. But hey! Let’s assume we have two folders (private and logs) which we don’t want to be updated when checking in changes to our repository. We can now set ignore rules to avoid them being checked in:

propedit :ignore .

An editor will open – this can be VIM, nano or whatever you have set as your shells default editor. Enter the following lines and save+close:

/private
/logs

You can also set single files or wildcard specs to be ignored:

/log/*.log
/private/*
/private/myDocument.txt

Once you’re done, let’s check in our changes to the repo:

ci

Now you can enter a message (for the first time I use “initial commit”), save+close and you will notice that works on your changes and gives back a revision number. This is your current version.

Once you’re done, I’d suggest making an update, removing our repo and checking out only / since you won’t need and when working locally:

up
cd ..
rm -rf myAPP
co http://www.mydomain.com//myAPP/ myAPP

Now you’re set!

Share this on:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Add to favorites
  • email
  • MisterWong
  • MySpace
  • Reddit
  • RSS
  • Yahoo! Bookmarks

Related posts

Comments
Leave a Response
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <img src="">