Advocacy vs. git

Colin Caughie c.caughie at indigovision.com
Sat Apr 25 01:38:26 CDT 2009


> Two final points that I think are worth making.  First, "git rebase
> -i" is nicer than MQ simply because you don't have to do much in the
> way of setup.  If you have done a series of commits, and then decide
> that, before you've pushed them out, that you want to squash two
> commits together, and perhaps edit the commit log for a third, you
> can
> use "git rebase -i" for quickly and easily.  With MQ you have to
> spend
> a bit more time setting up the mq.  The functionality is equivalent,
> but it's just perhaps less convient for ad hoc use.

You can also use "hg rebase --collapse" to collapse the commits you're rebasing (equivalent of git's squash). For more control over what gets collapsed, or to collapse even when not rebasing, you can use my collapse extension at http://bitbucket.org/ccaughie/hgcollapse/wiki/Home.

> They might be more _painful_ to use, sure.  So for me, if we must
> talk
> about "killer features", the one which is why I prefer to use git is
> "git commit --amend".  I will very often create a commit, and then
> about 30 seconds later, realize that I had typo'ed a comment, or the
> feature could be made even better if I made some further changes.
> So
> at that point, I'll quickly edit the source files, make the further
> enhancements, and then use "git commit --amend foo.c".  I do this
> ***far*** more often than I use rebase.
>
> Could I do the exact same thing in Mercurial?  Sure.  I can save the
> commit message via "hg log" or "hg export", then do a "hg rollback",
> edit the files, then do a "hg commit" and pull in the original
> commit
> message and update it if necessary --- but "git commit --amend
> foo.c"
> is *easier*.

It strikes me that the collapse extension could be modified fairly easily to support this. It already collapses multiple revisions and preserves their comments, so amending an existing commit could be as simple as committing the new changes and then collapsing with the previous one, editing the description as you go.

Colin


Latest News at: http://www.indigovision.com/news2009.php



More information about the Mercurial mailing list