Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

So "tags" for versions and "branches" for new features?

I'm a little bit new to the distributed version control systems, so I was reading Mercurial manual and what I understood is the tag feature can be used to mark release numbers, example a tag called v1.0 and another v1.1, etc.

As for branches they are to be used to add new features without disturbing other developers then merge it with the default branch after everything is OK.

Is that right?

Please advise. Thanks.

like image 662
emurad Avatar asked Dec 02 '22 04:12

emurad


2 Answers

Sounds like you're mostly getting answers from git folks, who almost understand Mercurial too.

The core difference is that in git the branch name isn't an integral part of a changeset -- it's just where the changeset happens to be now. In mercurial a Named Branch's name is part of it forever. This leads folks who know git more than they know Mercurial to say one of two not-quite correct things:

  • Named branches should be used on a per-feature basis -- There's nothing wrong with using a named branch per feature in Mercurial, but since those branch names never go away your hg branches output can grow quite large.
  • Branching in Mercurial isn't as lightweight as in git -- Named Branching in Mercurial isn't quite as lightweight (they're permanent) but that's why it's not the norm for features. Anonymous branching in Mercurial is more lightweight than git's named branches, and Bookmark branching in Mercurial is exactly the same as git branching.

All of this is spelled out beautifully in Steve Losh's Guide to Branching in Mercurial, as originally answered by OJ (which I upvoted).

In summary:

  • git
    • releases: tags
    • features: branches
    • lines of development (stable, etc.): separate repositories
  • mercurial:
    • releases: tags
    • features: bookmarks or anonymous branches
    • lines of development (stable, etc.): named branches

Of course, either tool can be used in either fashion -- it's more about norms than it is about "correct".

like image 75
Ry4an Brase Avatar answered Dec 03 '22 22:12

Ry4an Brase


Have a read of the following to help clarify your understanding (Mercurial related):

  • A guide to branching in Mercurial
  • Mercurial Workflows: Branch as Needed
  • Mercurial Workflows: Stable and Default
  • Mercurial Workflows: Translation Branches
like image 27
OJ. Avatar answered Dec 03 '22 23:12

OJ.