Tuesday, December 29, 2009

Use Source Control For Your Thesis

Why?
  • Back up old versions without scattering dozens of files everywhere.
  • Free online hosting with Google - create a message board, wiki, group commenting section
  • Immediately push in revisions from the committee or other trusted contributers
  • One central repository for your thesis, no need to back it up a dozen places
I found out how to do this too late for my own thesis, so here are the simple steps you can take to do it yourself.
  1. Download and install Subversion client and TortioseSVN.
  2. The client is hosted at CollabNet, you probably want the Windows binaries, Server and Client.

    You have two choices here. If you want to make your own server (so you can easily get at it anywhere) follow this guide. For a more simple, file based approach, uncheck the SVNSERV and Apache_Mod check boxes in the installer and install it in whatever directory you want.

    TortoiseSVN is a handy front-end that plugs into Windows Explorer. You can find it here.

  3. Make a repository.
  4. Right click on a folder where you want to put the repository (the database containing your thesis) and select TortoiseSVN-->Create repository here.

  5. Make up some folders for the database.
  6. Right click TortoiseSVN-->Repo-browser. The URL it asks for can be your server (if you made one) or "file:///C:/svn", without those quotes, where the folder of your repository is C:\svn.

    The Repo-browser shows the contents of your database. Right now, it is empty. You pull stuff in by right-clicking (starting to see a pattern?) in the right hand panel of the browser and selecting "Add folder...", "Add Folder...", or "Create folder...".

    You'll notice that everytime you add something, you can put in a note saying what you added, changed, or deleted. Very handy if you want to roll back to a previous change you made.

  7. Add your thesis into the database.
  8. This is easy, simply right-click as above and Add File. This will be your authoritative copy from here on in. You can check out local versions, modify them, then push the modifications to the database.

  9. Check out your thesis.
  10. Another right-click operation, this time target open folder with the files you want and put it in a local folder.

    The place you put it becomes your "working copy". You can make as many of these in as many different locations as you want. Subversion handles how up-to-date a current working copy is, and lets you chose if you want to keep parts of the repository copy ("theirs") or your local copy ("mine") when you check it back in to make changes.

  11. Make some change to your local copy.
  12. The nature of your change is basically unimportant. Any change to the file will change the icon next to the file in Explorer to a red "!" rather than a green . This shows that changes are pending - there is a difference between your local copy and the server. You can check what exactly changed by Right Click-->Check For Modifications-->Right Click on a file--> Compare With Base.

    If you are using a Microsoft Word document for your thesis, stop doing that. Seriously. Pick up LaTeX and save yourself six months of infuriating style editing in the future for this and every subsequent paper you do. Anyway, if you are using a Word document you can still use Subversion, you just can't use the nifty diff tool with it. Only plaintext works, Word documents are binary files.

  13. Check in your change.
  14. Checking in your change is simple, just Right Click-->Commit. You can also check what has changed compared to the stuff in the repository by right clicking as in the above step.
You can use this for all kinds of important documents. Anyone you give permission to can post changes, and you can see exactly what changed and whether to keep the changes (look for the Update To Revision in the right click context menu). Finally, if you do any programming or scripting at all, you are doing yourself a great disservice by not using source control. Plus, it is a great skill to put on a resume/CV.