Twitter  Facebook  YouTube  E-Mail  RSS
The One Man MMO Project
The story of a lone developer's quest to build an online world :: MMO programming, design, and industry commentary
The Double Edged Sword of Version Control
By Robert Basler on 2010-10-08 14:10:13
Homepage: email:one at onemanmmo dot com

Every couple of years I mess up with my version control program and delete a bunch of stuff I didn't mean to. It's my own fault for not reading the dialog boxes thoroughly, and for deliberately not saving a backup copy before making the changes, but it still sucks. Yesterday while trying to roll back changes to three files, I accidentally rolled back the changes to the 20 or so other files I had made changes to over the previous two days. AAAAaaaaaaaaarrrrgggghhhhhh!

Ok, I feel better now. And I'm still a strong believer in version control. The ability to roll back changes and track changes over time is just too worthwhile not to do.

If you haven't tried version control before, go get a copy of TortoiseHg (it's free) and install it. Tortoise is a friendly gui extension for the straight Mercurial version control system. Mercurial works only as a command line tool, Tortoise makes it much friendlier, including KDiff3 which works really well for visually diffing your changes. You only need to install the Tortoise package as it includes the latest Mercurial release and KDiff3.

To learn Mercurial, I recommend you read through Mercurial: The Definitive Guide by Bryan O'Sullivan. This book takes you through the basic command lines you will use, and gives you an overview of the general mode of operation for Mercurial. As you read it, don't freak out! Mercurial is kind of scary when you start reading about it. In practise, particularly for a single developer, it is really easy to use.

Previously I had used Perforce, which works just fine, but isn't free, and for a single developer, is overkill. The thing I really like about Mercurial over Perforce, is that in Perforce, you have to open a file for edit (in another program) before you can start making changes to it. With Mercurial you don't have to decide ahead of time what files you're going to edit. You just edit files, and when you're done, Mercurial tells you what files you have changed (an lets you view the diffs.)

You can make Perforce easier to use by creating a button in your editor to run the P4 command to open the file you are editing, but it is still more of a pain than just editing the file.

So how does it work? First, use Mercurial to create a depot of the files in your program. Next, right click on that folder in Windows Explorer and select Hg Commit. Enter a description of your changes like "initial source commit" then click on the Commit button. Now I haven't done this in a while, so you might have to check the box next to all your files and push the Add button so that Hg knows to track them before selecting Commit. And you're going. Make some changes, select Hg Commit again and you can see your changes highlighted.

There are other steps if you are coordinating with other users, but for a single user needing to keep track of changes to their work, this is about it.

You may find you need to use Mercurial's command line from time to time (for example, to move a file to a new folder or for scripting) but for most things, the gui works just fine.

New Comment

Cookie Warning

We were unable to retrieve our cookie from your web browser. If pressing F5 once to reload this page does not get rid of this message, please read this to learn more.

You will not be able to post until you resolve this problem.

Comment (You can use HTML, but please double-check web link URLs and HTML tags!)
Your Name
Homepage (optional, don't include http://)
Email (optional, but automatically spam protected so please do)
What color is the ocean? (What's this?)

  Admin Log In

[Home] [Blog] [Video] [Shop] [Press Kit] [About]
Terms Of Use & Privacy Policy