Posted on 2010-03-31 22:54 in Blog • Tagged with programming, competition, version control

For the last three weeks, development on my news program, Iceberg Races, has been in high gear. Each night before bed, I simply zipped up my work and archived it away. This approach was fine at first, as I was hammering out the design as I coded, which meant I took a lot of dead end paths. Large chunks of code and entire files were created and then deleted the next day (as I discovered better implementation methods.) It’s true that the best way to learn a language is to dive right in by writing ‘useful’ program.

On Wednesday, I realized that my code structure had stabilized a week prior and I was overdue for tracking my code in a source revision tool. Luckily, I ran across an amazing Mercurial tutorial and decided to give it a try.

So far I’m loving it. The commands are all straight forward. It was extremely quick to setup, and has perform admirably for the past two three days that I’ve been using it. I’ve summarized the most useful commands below (this is not an exhaustive list):

Command Description
hg * All commands start with hg followed by…
init Create a new repository in current directory.
add Add new files to repository
remove Remove file from repository
status View the status of the files in the repository.
diff View the differences between two different versions of a file.
commit Save the current state of the files to the repository.
rollback Undo the last one commit.
merge Resolve conflicts in a file.
log View the revision history.
update Check out files to a specified revision
push Copy changes in local repository to a remote repository.
pull Copy changes in a remote repository and bring them into your local repository.

I’ve bolded the commands that come in the handiest. This includes the operations to save the current state of the repository and how to restore a past state.

Continue reading