[ECOS] Replacing CVS - decision time: part 2

Bjørn Forsman bjorn.forsman@gmail.com
Thu Apr 29 13:25:00 GMT 2010


2010/4/28 Alex Schuilenburg <alexs@ecoscentric.com>:
> On 2010-04-28 20:26, Bjørn Forsman wrote:
>> [,,,]
>> Git may be worse than hg on Windows, but IMHO git has better branching
>> and tagging.
> Could you please explain why you think git has better branching and tagging?

This below is what I *think* is correct, based on my current knowledge. It
may very well be wrong. If so, maybe someone will enlighten me?

hg branching (skipping unnamed branches and entire repo forks/clones):
* either bookmark branches (local branch)
* or named branches (global branch)

A hg bookmark is a lightweight branch that can only be used locally. It
cannot be pushed to another repo. A named branch can be pushed to another
repo. So when using hg one would have to choose branch type at branch
creation time. With git you create branches and later choose to push them
if you want to. You can also push specific branches, not just all at
once like hg
does. You can also rename git branches. Hg named branches are stored as
metadata in changesets which makes it impossible to rename them. Named
branches cannot be deleted either, only hidden.

About tagging:
hg supports local and global tags. local tags cannot be transferred to
other repos. global tags can be pushed to other repos and are stored in a
.hgtags file, versioned as any other file.
This means:
* When tagging changesetN, changesetN+1 is the one that has the newly
  created tag included in .hgtags. A bit confusing?
* hg must scan all versions of .hgtags in all branches to find its tags
* *all* tags in .hgtags will be transferred to other repos upon push

git allows pushing specific tags, I don't have to choose up front whether
this new tag is to be global or not. I create it and later decide if I want
to push it. This seems more flexible to me. git supports annotated tags and
simple tags, but both seems to be able to be selectively pushed to other

I found [1] very helpful in understanding more about hg branching. It also
compares hg branching to git. And [2] is great for comparing hg vs. git
consepts. It is easy to read.

BTW, about two years ago I was in the process of deciding between git and
hg myself. It was a very close call, but I choose hg because it had better
Windows support (at least at that time) and was written in Python. However,
nearly all projects I worked with after that point was using git, so I
became a git user. I love the way git completely changed the way I think
about and work with a SCM system. But I guess hg users feel just the same
way :-)

[1]: http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/#comparison-to-git
[2]: http://mercurial.selenic.com/wiki/GitConcepts

Best regards,
Bjørn Forsman

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list