DEV Community

Discussion on: Is Git Great? #healthydebate

Collapse
 
ecyrbe profile image
ecyrbe • Edited

I also used Mercurial for a long time. It has all the same mindset, that everything is decentralized and your local repository can synchronise with a remote one. It also uses acyclic graph to represent your history.

To sumarize key diffs :

  • git branch are just a reference to a commit (called light branches/ bookmarks in mercurial), where as in mercurial your branch and your commit are glued together with a name (called heavy/named branches). This has some impacts i'll explain below...
  • git allows to change remote history, whereas in mercurial you can only change your local history...
  • mercurial named branches, comes with what is called phases that are status attached to your local version of your branch and for example allows for good rebase defaults. it's impossible in mercurial to rebase in the wrong order (rebase remote on your local), you can only rebase your local to your remote. this evoids rooky mistakes on rebase commands.
  • there is no stagging area in mercurial, so if you want to only add a part of a file to your next commit, you have to use tools like interactive commits.
  • there is no patch system in mercurial, but you have a plugin called queues that are a mix of patches and stash. It's definitely easier to understand for new users than the patch system of git.
Thread Thread
 
michelemauro profile image
michelemauro

Also:

  • there is a bundle file format, that can carry around commits and branch names safely between repositories (in fact, I used it to collaborate before BitBucket was there). This file format enables me to collect the homeworks from my students with the certainty that they will not be able to mess up with my repository. I'm not sure if that can be done in git with the same level of peace of mind.

And as for the rebase thing, there was a solution in the works a few years ago: I don't know now if it has been deployed.

The staging area is maybe the only thing in git that I find remotely useful, sometimes. But I went on for years without it, and sometimes it just gets in the way.