So, “tags” for versions and “branches” for new features?

I am a little new to distributed version control systems, so I read the Mercurial manual and I realized that the tag function can be used to indicate release numbers, for example, a tag named v1.0 and another v1. 1 etc.

As with branches, they should be used to add new features without interfering with other developers, and then merge them with the default branch when everything is in order.

Is it correct?

Please inform. Thanks.

+4
source share
5 answers

It looks like you mostly get answers from git people who also almost understand Mercurial.

The main difference is that in git, the branch name is not an integral part of the change set - it is just where the change is now happening. In mercurial, the name Named Branch is part of this forever. This leads people who know git more than they know Mercurial to say one of two not quite right things:

  • Named branches should be used according to the principle of each function. There is nothing wrong with using a named branch for each function in Mercurial, but since these branch names never disappear, your hg branches output can grow quite large.
  • Branching in Mercurial is not as easy as in git - Named branching in Mercurial is not so simple (they are constant), but why this is not the norm for functions, Anonymous branching in Mercurial is easier than git named branches, and insertion branching in Mercurial is exactly like that same as git fork.

All of this is beautifully written in the Steve Laws book, Mercurial Branching Guide , as OJ (which I supported) originally answered.

In short:

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

Of course, any tool can be used in any way - it is more about norms than about the "right" one.

+9
source

It’s good that the question depends on your point of view. In git, branches are used for many purposes (i.e., One is development). Actually everything is in the git branch . And in each branch there may be different tags .

I would recommend reading this gread tutorial as it explains a lot about branches and releases:

http://nvie.com/posts/a-successful-git-branching-model/

+3
source

The two answers about git correctly agree with you that tags are good for releases, and branches are good for new features, but don't really explain why.

The git tag constantly points to this commit. This means that it is really only useful for marking a stage, such as a release.

On the other hand, a branch can be checked and committed, which means that the branch will advance to indicate a new commit. This makes branches a way to work in git; anytime you commit, you want the corresponding branch to be checked so that it captures your progress. This includes new features, as you say, but also any other work.

The situation in Mercurial is basically similar, although branching is not so easy, so you will not branch out as often as in git. And tags are handled a little differently, but are still good for marking releases.

+2
source

I am not a Mercurial user (I use Git), but as far as the Git workflow works, you are already dead. Branches are used, often by a single developer, to work with their own fixes / functions before merging with the main branch.

Tags are commonly used in the main branch to mark milestones, often issued. This allows you to easily return to this state without having to use commit numbers (which in Git are long strings of hexadecimal digits, not sure how Mercurial works).

Gary

0
source

All Articles