Flag This Hub

Version Control for Writers - Traveling Back in Time with Mercurial

By


In my previous article Version Control for Writers - Mercurial 101, I showed you how to install and configure Mercurial on Windows. I also demonstrated Mercurial's most basic workflow, with which you can both protect your creative work and review your work progress.

When you are familiar with the basic of Mercurial, it's time to learn something new. Today I'm going to show you how to go back to the history (yes, time machine!) when you are not happy with your progress. Using this technique, you can feel free to drive your creative writing in any direction without having to manually copy or back up your files first. If you are not happy with where your writing is heading towards, you can just back out to where you were at any time. You can even back out your back-out when you find what you threw out is useful instead. There will be no risks. You won't lose anything.

Sounds interesting? Let me show you how to do it.

Mercurial: The Definitive Guide
Probably the best book on Mercurial. I used this book when I started learning Mercurial.
Amazon Price: $28.94
List Price: $39.99

1. The first thing you would do is to display your commit history. Go to the folder where your Mercurial repository is located, and right click on the blank space. In the context menu, choose Hg Workbench.

2. Make sure your repository is selected on the left, you should be able to view your commit history on the right. In the screenshot below, there are two commits (you can ignore the top most one that says 'Working Directory' for the time being) with the oldest one sits in the bottom and the newest one (most recent committed) on the top.

See all 2 photos

3. Select the one row that says "WIP - added 'how to get started' section". When you select it, Mercurial will display all the files that were included in that commit (in the example we have only one file). You can also see what content has been changed in that commit. This is very handy when you want to know what you have done in that commit.

4. Suppose that you are not happy with that commit, what you can do is to back it out, so the content of your file is changed to before that commit is made. You can right click on that row, and select Backout.... There will be a dialog pop up. You can either change the default message to be more specific on why you would back it out, or just leave it there. Then just click Backout. Now when you open that file again, you would see that all the changes contained in that commit have gone. Your file has returned back to its previous state.

Using this technique, you no longer need to manually copy/back up files before you make changes. If you are not happy with whatever you write, just back it out. Isn't this simple yet powerful?

Comments

No comments yet.

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    Like this Hub?
    Please wait working