Wednesday, October 03, 2007

Let the Tortoise help you create a Time Machine

What the hell am I talking about? Fasting got into me? not really. I am talking about a software tool that you can use to create a "Time Machine". To the Past only.
Imagine you can store every single version of a file, and can easily get back older versions of the file. Then you can compare your current version with any old version, or compare any older two versions. This is the Time Machine Part.
The software that makes this possible is called SVN. Or Subversions. It was originally used to manage programs, and that is how I got to know about it and use it. It can be used to allow multiple developers to access the same code base, make modifications, share them, and put them back so other developers can share them. I will not dig too much into that.
The tool that makes this really easy is called TortoiseSVN. And that is the Tortoise Part.

TortoiseSVN, after being installed on Windows, adds sub menus to Windows Explored Right Clicks, and makes all of the usually difficult SVN work very simple.

To get started, you need to create a Repository. Choose a location that has enough space to hold the files you want to keep a history of, and create a Repository there. Do not do any file operations in that place. The repository is not meant for normal file browsing. It just contains the files you put with all the history in internal, SVN format.

The initial step of adding files to the repo is a bit tricky. But you only do it once, and if you follow these instructions, you should be fine:
  1. Go to the folder you need to version
  2. Right click, select TortoiseSVN | Import
  3. Select the location of the Repository you created earlier.
  4. Put a comment if you want; "initial Import" is a good choice.
  5. You will be at Version 1.
  6. Now you have your files in the SVN repository. You can delete this folder (backup, just in case).
  7. Now you need to get the same folder from SVN, delete all files in the folder, but keep the root folder.
  8. Go up to your root version folder, which is now empty, and right click, SVN Checkout.
  9. You should now have all your original files, with nice SVN icons overlayed on top. If that does not work, you missed something. You can try again or leave me a comment.
  10. This place will be used as your normal Working Folder from now on.
You then have these major operations to do with your repository.
  1. Import: Add new files from Working Folder to the repository (this can also be done by Add)
  2. Commit: is putting the files from the Working Folder into the repository. Only changed files will be written to the repository, and only the differences are written for most files.
  3. Checkout: is getting the files from the repository to a new Working Folder.
Remember that you should not use the Repository location. Perform all the above operations from your Working Folder from now on.

After this is up and running, you can do all sorts of things with SVN. You can check the differences you made, you can get any old file that you have committed to the repository, compare any two revisions, and other cool stuff for programmers.

But you do not need to be a programmer to use SVN. TortoiseSVN works with not just text files, but Word Documents, Images and other file types too.

4 comments:

BuZain said...

Interesting. This means you can do version control without having to install any server software. right?

Ayman said...

Yup. You do not need a server. Even for a group repository, you can just host the Repository on a shared folder and get away with installing a server.

Re.Loaded Soul said...

That is just amazing!
I have always wanted to do that, and shall try it..

I am wondering why then when I recently asked one of the famous (not because of their proficiency) IT companies to get our recent release of the front-end system on a specific date, and they come and said this is not possible due to many other firms are using the same version, and we should wait till all gave their feedback, only then we can hand over the release for you!!

Ammaro said...

reminds me of something similar. not exactly the same but a close idea. alexa.com has a time machine for webpages. you can enter the website and see how it looked a year ago, 5 years ago, 10 years ago, etc :D

Just Google it!