How to Set Up The World’s Simplest Version Control & Backup System (Takes Like 5 Minutes)

I’ve used some version control system such as SVN, and different backup software but all of them have one problem: these complex systems might require quite a lot of work to set up, and it’s quite likely that you’d need technical guidance to get them to work (well, I suppose unless you happen to be an unix geek). That’s why I wanted to try something different. Something simpler that does the job.

The simple version control system
During the last weekend I looked into setting up a very simple backup / version control system, and it took me like 10 minutes to find the necessary information and set everything up. It isn’t the most optimized system to back up stuff, but at least it’s extremely simple and it does what’s it supposed to do: it backs up data and creates versions.

I used the information provided by the LifeHacker simple version control and did some modifications to make it work for me.

Step-by-step guide for setting up a version control system
(I’m using Dead Wake game example here)

  1. First I created a folder “G:\Dead Wake\versioncontrol” (it’s on my second hard drive)
  2. Then I created a “versioncontrol.bat” file and put the following code inside it (this all should be in one line):

    xcopy “D:\Dead Wake\development” “G:\Dead Wake\versioncontrol\%DATE%” /V /I /S /Y

    (This copies my development folder files under the versioncontrol folder, and creates a ‘date’ folder there. Notice that I use the /Y to overwrite files automatically: since I launch this backup script several times a day, but want to store only the latest version for one day, I have made it to overwrite possible files)

  3. Last but not least, I used the Vista’s Task Scheduler to create a “Dead Wake version control” task: it will launch “versioncontrol.bat” several times a day.

    I created 3 triggers and set up it to launch version control “Daily at 10 o’clock”, “Daily at 14 o’clock”, “Daily at 18 o’clock”. (LifeHacker provides information on how to set up scheduled tasks)

And that’s it.

The results
Now the system will automatically backup the project folder three times a day and copy it under the version control folder. It also puts a date, so I can easily see on what date the version was created. If I want to manually launch the backup process, I can simply double click the “versioncontrol.bat” file.

Some notes
I realize that this isn’t as sophisticated nor optimized system. For example, it would copy only modified files (if you want to do that, then check out “xcopy /?”, there’s help information for that too), but to my needs this is good enough. The files aren’t compressed (zipped), but since I have only like 70 megs of data (and a big harddrive), it’s not a big deal.

Simple system
On a good side: you don’t need much expertise to set this up, and it’s very quick to run (of course depends how many megs you have) – and you can launch old versionsvery easily (since you don’t need to unzip anything) if needed.

Simplicity & easy of use in backing up data were my goals, and if you want to do something more sophisticated & optimized, then you gotta look from somewhere else.

Variation
If you don’t want a daily data, you can also use something like: (in the “versioncontrol.bat”)

xcopy “D:\Somestuff\” “G:\Somestuff Backup” /V /I /S /Y

This would copy everything under “D:\Somestuff\” folder to “G:\Somestuff Backup”. Notice, it wouldn’t create “date” folder, so it would be merely a one-time backup of your existing data. This can be useful for bigger amount of data, but this system would benefit from “copy only changed files” type of solution.

This way, the ‘mirror’ wouldn’t become too big. (Imagine if you copy 100 gigs of stuff, just to notice couple of days later that your harddrive got filled since there was so much data).

Anyway, this can be a good way to backup data that doesn’t change so often (unlike your current projects).

Word of warning
I think this system is as simple as it can get, but if you don’t know what you are doing, then be careful with the data folder sources and destinations, and do an alternative backup of your product files first (zip everything for example). You don’t want to overwrite your original stuff. Make some test folder backup first to see it actually works. I won’t be taking blame if you manage to overwrite your project files when setting up this backup system.

It shouldn’t happen, but I just want to make sure we know what we are doing here.

Thanks to LifeHacker.com for the helpful tips.

Update: Tip from Toni for compressing files:

I did make something similar but I added a command-line compressor because them files tend to add up fairly quickly. I used 7-Zip cmdline version.

Here’s instructions on how to get 7-Zip command line version working

20 thoughts on “How to Set Up The World’s Simplest Version Control & Backup System (Takes Like 5 Minutes)

  1. Tuomas

    It’s nice hack, but I wouldn’t recommend it to anybody. Versioning control is so fundamentally useful in any project regardless of scope or team size…

    Reply
  2. Lorenzo

    Brilliant just found this today. I’ve been backing up with Idrive and thumb drives, this approach will work perfectly on my non networked machine. I was going to install SVN, I may still but at least I’ll have something while I’m learning the ins and outs of SVN.

    Reply
  3. Anonymous

    Setting up version control is not so difficult, really… And it covers much more than just backing up your project’s folder.

    Just as an example: what if you have large files that never change (say, a 3d model). This mechanism would copy it over and over again…

    This technique may be useful for VERY small projects, but I wouldn’t say it’s a good idea in general.

    Reply
  4. DtD Software

    In Windows XP Pro (Not sure about Home or Vista) you can set folders to be compressed automatically.

    If you right-click a folder and hit properties.
    Then click advanced
    There are check boxes for Compress and Encrypt, if you check compress it compresses it.

    How much does it compress it? No idea, but I used it for my videos and backup folders.

    Also, you could use the command line tool WinSCP.com that comes with WinSCP (http://www.winscp.net/) to syncronize your backups with remote servers.

    ~DtD

    Reply
  5. Lorezo Gatti

    If you want to archive revisions blindly and automatically, there is a better option than xcopy or rsync.
    If you use Git (or, I presume, Mercurial in very similar ways) with automatically generated commit comments:
    - the pile of revisions is even more compact than if you take advantage of hard links;
    - it’s highly portable;
    - it’s very unlikely to corrupt copies in case it’s interrupted;
    - you can make “real” commits with edited comments from time to time;
    - you can easily use both local repositories for fast operation and remote repositories for backup and sharing;
    - you can access your fellow developers’ repositories and merge anything you need;
    - you have an actual VCS at your disposal when you want to look back at earlier revisions;
    - you can transition smoothly from a mere backup to mature version control practices in general.

    Moreover, Git is so fast that it might make sense to link the backup script to run before the compilation command rather than using a fixed schedule.

    Reply
  6. Juuso Hietalahti Post author

    well, it’s pretty much the same as with normal “copy paste”: I suppose file gets copied? (try editing for example some file manually when copy pasting it somewhere else to see what happens)… so I doubt there’s a problem even if you are compiling/changing/whatnot files and backing them up simultaneously.

    Since the version control “pops up”, you can notice when it’s copying stuff – and can launch it manually too… (if you happen to worry a failure).

    Reply
  7. Jake Birkett

    I use a bat file to that I launch manually. One thing, what will happen if you are hitting save in your compiler just as the batch file is trying to copy that file? Will either process fail? I launch my batch file manually when I’m not in the compile.

    Also I used 7-zip for command line compression too, it works well and is free.

    Reply
  8. luis

    Installing (under windows) an SVN server took me 10 minutes including downloading, starting service and creating a repository. Under linux it would take 5 minutes probably.

    Spend time learning how to setup an SVN/CVS etc instead of wasting your time with silly BAT files….

    Reply
  9. David Sveningsson

    Juuso: I guess I’m one of those “unix geeks” then :)

    For *nix there is a similar way using rsync and hard links. The procedure is quite the same but unmodified revisions won’t take any extra space. I use this for complete backup of my systems. With no modified files the backup take almost no additional space.

    #!/bin/sh

    date=`date “+%Y-%m-%dT%H:%M:%S”`
    rsync -a –include-from=/etc/backup/include –exclude=”/*” –link-dest=/backup/current / /backup/backup-$date
    rm /backup/current
    ln -s /backup/backup-$date /backup/current

    Reply
  10. Beefy

    Thanks a lot. I never bothered to do such a thing, but just coppied manually once in a while, but this is so simple, I should have done it long time ago. And it copies it simply and nothing else that you don’t want it to do, just the way I like it.

    And if you ever needed it to be zipped/rared, that would be pretty easy to include in the .bat file. You could even make another bat for that, that would be launched weekly or something.

    Reply
  11. Josh

    My compiler will erase the source code if the power is cut during compilation. I am very careful during storms!

    Reply

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Pro-Human Quiz: