所以“标签”是对于版本和“分支”对于新功能?
我对分布式版本控制系统有点陌生,所以我正在阅读 Mercurial 手册,我了解到标签功能可用于标记版本号,例如一个名为 v1.0 的标签和另一个 v1.1 等 至于分支,
它们将用于添加新功能而不打扰其他开发人员,然后在一切正常后将其与默认分支合并。
是这样吗?
请指教。谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
听起来您主要是从 git 人员那里得到答案,他们也几乎了解 Mercurial。
核心区别在于,在 git 中,分支名称不是变更集的组成部分——它只是变更集现在所在的位置。在 Mercurial 中,命名分支的名称永远是其一部分。这导致那些对 git 的了解比对 Mercurial 的了解更多的人会说两件不太正确的事情之一:
所有这些都在 Steve Losh 的 指南 中详细阐述到 Mercurial 中的分支,正如 OJ 最初回答的那样(我投了赞成票)。
总结:
当然,这两种工具都可以以任何一种方式使用——它更多的是规范而不是“正确”。
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:
hg branches
output can grow quite large.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:
Of course, either tool can be used in either fashion -- it's more about norms than it is about "correct".
阅读以下内容有助于澄清您的理解(Mercurial 相关):
Have a read of the following to help clarify your understanding (Mercurial related):
嗯,这是一个取决于你的观点的问题。在git中,分支有很多用途(即一个是开发)。事实上,git 中的一切都是分支。并且每个分支中可能有不同的标签。
我建议阅读这个很棒的教程,因为它解释了很多有关分支和版本的事情:
http://nvie.com/posts/a-successful-git-branching-model/
Well that's a question that depends on your point of view. In git, branches are used for a lot of purposes ( i.e. one is development). In fact, everything in git is branch. And there may be different tags in each branch.
I've would recommended to read this gread tutorial, as it explains a lot of things about branches and releases:
http://nvie.com/posts/a-successful-git-branching-model/
关于 git 的两个答案正确地同意你的观点,即标签有利于发布,分支有利于新功能,但并没有真正解释原因。
git 标签永久指向给定的提交。这意味着它确实仅适合标记发布等里程碑。
另一方面,可以检出并提交分支,这意味着分支将前进以指向新的提交。这使得分支成为 git 中的工作方式;每当您进行提交时,您都希望签出适当的分支,以便它记录您的进度。正如您所说,这包括新功能,但也包括任何其他工作。
Mercurial 中的情况大多相似,尽管分支不是那么轻量级,因此您不会像在 git 中那样频繁地进行分支。标签的处理方式略有不同,但仍然适合标记版本。
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.
A git tag permanently points to a given commit. This means that it's really only good for marking a milestone like a release.
A branch, on the other hand, can be checked out and committed to, meaning the branch will advance to point to that new commit. This makes branches the way to work in git; any time you make a commit you want to have an appropriate branch checked out, so that it will record your progress. This includes new features, as you say, but also any other work.
The situation in Mercurial is mostly similar, though branching is not quite so lightweight, so you won't be branching as frequently as you would in git. And tags are handled a bit differently, but are still good for marking releases.
我不是 Mercurial 用户(我使用 Git),但就 Git 工作流程而言,您已经完全掌握了。分支通常由一名开发人员使用,在与主分支合并之前修复自己的错误/功能。
标签通常用在主分支上来标记里程碑,通常是发布。这可以让您轻松恢复到该状态,而无需使用提交号(在 Git 中,提交号是十六进制数字的长字符串,不确定 Mercurial 是如何工作的)。
加里
I'm not a Mercurial user (I use Git), but as far as the Git work flow goes you've got it dead on. Branches are used, often by one developer, to work on their own bugfixes/features before merging with the main branch.
Tags are normally used on the main branch to tag milestones, often releases. This lets you revert to that state easily, without having to use commit numbers (which in Git are long strings of hexadecimal digits, not sure how Mercurial works).
Gary