来自分支的 Mercurial 克隆

发布于 2024-10-09 14:43:09 字数 89 浏览 0 评论 0原文

我们有一个包含三个命名分支的存储库,我想克隆其中一个分支。有一个善变的命令可以做到这一点吗?如果我使用 hg clone 提供(分支)路径,则会收到 404 错误。

We have a repository with three named branches, I wanted to clone one of the branches. Is there a mercurial command to do that? If I provide the path (of branch) with hg clone I get 404 error.

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

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

发布评论

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

评论(5

つ可否回来 2024-10-16 14:43:09

hg clone http://your/repo -rbranchname 应该可以解决问题。

hg clone http://your/repo -r branchname should do the trick.

樱花坊 2024-10-16 14:43:09

本杰明是对的。但这真的是你想做的吗?特别是,您只会获得组成该分支所需的变更集,而不会获得其他任何内容 - 例如,这会阻止您从主干或其他分支拉入变更集。您最好克隆整个存储库,然后在您感兴趣的分支中工作;这将使您的存储库与您更轻松地从中提取的存储库保持同步。

Benjamin's right. But is that really what you want to do? In particular, you'll only get the changesets needed to make up that branch, and nothing else - and that would, for example, prevent you from pulling changesets in from the trunk or other branches. You might well be better off just cloning the entire repository and then simply working in the branch you are interested in; this will let you keep your repository in sync with the one you're pulling from more easily.

翻身的咸鱼 2024-10-16 14:43:09

hg 克隆-b BRANCHNAME 根据要求克隆单个分支

hg clone <URL> -b BRANCHNAME clone single branch, as requested

蓝眸 2024-10-16 14:43:09

我知道这篇文章很老了,但我也有同样的问题。我发现了这个技巧:

hg clone /path/to/your/repo -r 0
hg pull -u -b branchname

I know that this post is very old, but I had the same question. I found this trick:

hg clone /path/to/your/repo -r 0
hg pull -u -b branchname
江湖正好 2024-10-16 14:43:09

我正在使用 Mercurial-4.0.2。我们可以通过在克隆 URL 中附加分支名称和 # 符号来指定分支名称。

例如

hg clone https://user@cloneurl/my_product#MY_BRANCH

hg clone --verbose https://user@cloneurl/my_product#MY_BRANCH "C:\myCode"

I'm using Mercurial-4.0.2. In that we can specify the branch name by appending branch name with a # symbol in the clone url.

e.g.

hg clone https://user@cloneurl/my_product#MY_BRANCH

hg clone --verbose https://user@cloneurl/my_product#MY_BRANCH "C:\myCode"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文