所以“标签”是对于版本和“分支”对于新功能?

发布于 2024-10-06 05:21:39 字数 180 浏览 0 评论 0原文

我对分布式版本控制系统有点陌生,所以我正在阅读 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

谷夏 2024-10-13 05:21:39

听起来您主要是从 git 人员那里得到答案,他们也几乎了解 Mercurial。

核心区别在于,在 git 中,分支名称不是变更集的组成部分——它只是变更集现在所在的位置。在 Mercurial 中,命名分支的名称永远是其一部分。这导致那些对 git 的了解比对 Mercurial 的了解更多的人会说两件不太正确的事情之一:

  • 命名分支应该在每个功能的基础上使用——有在 Mercurial 中为每个功能使用命名分支并没有什么问题,但由于这些分支名称永远不会消失,因此您的 hg 分支输出可能会变得非常大。
  • Mercurial 中的分支不如 git 中的轻量级 -- Mercurial 中的命名分支并不那么轻量级(它们是永久性的),但这就是为什么它不是常态的原因对于功能。 Mercurial 中的匿名分支比 git 的命名分支更轻量级,Mercurial 中的书签分支与 git 分支完全相同。

所有这些都在 Steve Losh 的 指南 中详细阐述到 Mercurial 中的分支,正如 OJ 最初回答的那样(我投了赞成票)。

总结:

  • git
    • 发布:标签
    • 功能:分支
    • 开发线(稳定等):单独的存储库
  • mercurial:
    • 发布:标签
    • 功能:书签或匿名分支
    • 开发线(稳定等):命名分支

当然,这两种工具都可以以任何一种方式使用——它更多的是规范而不是“正确”。

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".

樱花细雨 2024-10-13 05:21:39

嗯,这是一个取决于你的观点的问题。在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/

俯瞰星空 2024-10-13 05:21:39

关于 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.

楠木可依 2024-10-13 05:21:39

我不是 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文