我可以在 Mercurial 中进行分支而不克隆存储库吗?

发布于 2024-09-25 11:36:25 字数 343 浏览 4 评论 0 原文

最近,我开始尝试 Mercurial,因为它总是因其简单性和“正常工作”原则而吸引我。或者至少,其他人总是这么描述它。

他们通常也将其描述为“实际上与 git 相同,只有一些你不会注意到的细微变化”——只是我发现事实并非如此。

我的汞分支有问题。如果这是一个过于简单的问题,请原谅我,但在 git 中,有一个工作目录和一个存储库 (.git)。在回购协议中,有修订版本和分支,并且可以从一个版本跳转到另一个版本。

我在 Hg 中找不到类似的模型。据我所知,为了让 Hg 拥有一个“分支”,需要将存储库克隆到另一个目录?有没有一种方法可以像 git 一样工作,即一个工作目录和一个存储库,您可以在其中执行有关分支和转速的操作?

Recently, I've started experimenting with Mercurial, due to the fact that it always attracted it because of its simplicity and "just works" principle. Or at least, that's how others always described it.

They also usually described it as "practically the same as git with just a few minor changes you won't notice" - only for me to discover it isn't quite so.

I'm having problem with Hg branches. Pardon me if this is an overly simple question, but in git one has a working directory and a repo (.git). In the repo one has revisions, and branches, and can jump from one to another.

I'm having trouble finding a similar model in Hg. As far as I can see, for Hg to have a "branch" one needs to clone a repo to another directory? Is there a way Hg could work just like git does - i.e. one working dir., and one repo, in which you can do things as regard to branching and revs?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

一片旧的回忆 2024-10-02 11:36:25

Mercurial 支持非常丰富的分支方式。请参阅http://stevelosh.com/blog/2009 /08/a-guide-to-branching-in-mercurial/

简而言之,您可以通过运行创建一个命名分支

hg branch NewBranch

并使用以下命令切换到该分支

hg up NewBranch

或使用以下命令切换回主干

hg up default

Mercurial supports a very rich set of ways to branch. See http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/

In brief, you can create a named branch by running

hg branch NewBranch

and switch to that branch using

hg up NewBranch

or switch back to trunk using

hg up default
月光色 2024-10-02 11:36:25

在 Mercurial 中,如果您进行任何特定修订,您始终可以编辑您的工作副本并提交,从而制作另一个“头”。默认情况下,合并适用于头部修订。您可以使用 hg head 查看存储库中的头。这似乎是我在 Mercurial 中发现的最“惯用”的分支工作方式。

In Mercurial, if you go to any particular revision, you can always edit your working copy and commit, thereby making another "head." Merging works on head revisions by default. You can use hg head to see what heads are in your repository. This seems to be the most "idiomatic" way I have found branching to work in Mercurial.

骷髅 2024-10-02 11:36:25

查看 我在 StackOverflow 上对“Git 和 Mercurial - 比较和对比” 的回答。

有关 Mercurial 中分支可用的各种选项的信息(匿名头、未传播(我认为仍然)书签和全局(全球范围)提交标签又名命名分支)取自http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/,并使用 #mercurial< 上的反馈进行了扩展/code> FreeNode 上的 IRC 频道。

Take a look at section about branches in my answer to "Git and Mercurial - Compare and Contrast" here on StackOverflow.

The information about various options available for branching in Mercurial (anonymous heads, not-propagated (I think yet still) bookmarks, and global (world-wide) commit labels aka named branches) was taken from http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/, and expanded using feedback on #mercurial IRC channel on FreeNode.

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