hg vs git? Why not both?

For my projects, I prefer Mercurial over Git as the DVCS. Mostly, it’s a personal preference. Four years ago, when I was investigating what to use instead of Subversion, Mercurial seemed easier, so I stuck with it. Bitbucket, which at one time only hosted Mercurial repos, is free for personal projects, while Github charges at least $7/month to hold projects. SourceTree (Atlassian’s desktop app for DVCS) first handled Mercurial repos, then eventually handled Git repos. These people feel that git is good for distributed projects, while Mercurial is good for personal repositories.

SourceTree makes Git really easy to use. Eventually, I’ll get used to the command line instructions for git. I do know that more and more projects are saved in github and provide git instructions to download the files. I’ve used Heroku for a class on web applications and it made deployment very simple, as long as the project was stored it a Git repo. So … for now, I’ll run them both.

Usually, I start personal projects in Mercurial and get it set up and backed up to Bitbucket using SourceTree. I’ve realized that I need to set SourceTree/Mercurial to ignore the git files needed. Before setting up Git, I find the hgignore file and add ‘.git’ to the glob section. It’s much easier to set up hg to ignore files before they are committed into the hg repository. I’ve forgotten in the past and have found myself trying to run ‘hg remove’ (I think) on all the extra files that I can then ignore in hgignore. Too much efforts, when I can start the process on the right foot with the correct command.

I then set up git to watch the project directory with a simple ‘git init’ command. Before I add or commit anything to the Git repo, I update the gitignore file to ignore all the Hg files by adding ‘.hg/‘. I can then safely run ‘git add .’ and ‘git commit -m “first message” ‘ without worrying about all the HG files. It seems to work, so why not both.

One thought on “hg vs git? Why not both?

  1. Pingback: Still valid! | Chavez Coding Notes

Leave a comment