来自分支的 Mercurial 克隆
我们有一个包含三个命名分支的存储库,我想克隆其中一个分支。有一个善变的命令可以做到这一点吗?如果我使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
hg clone http://your/repo -rbranchname
应该可以解决问题。hg clone http://your/repo -r branchname
should do the trick.本杰明是对的。但这真的是你想做的吗?特别是,您只会获得组成该分支所需的变更集,而不会获得其他任何内容 - 例如,这会阻止您从主干或其他分支拉入变更集。您最好克隆整个存储库,然后在您感兴趣的分支中工作;这将使您的存储库与您更轻松地从中提取的存储库保持同步。
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.
hg 克隆-b BRANCHNAME
根据要求克隆单个分支hg clone <URL> -b BRANCHNAME
clone single branch, as requested我知道这篇文章很老了,但我也有同样的问题。我发现了这个技巧:
I know that this post is very old, but I had the same question. I found this trick:
我正在使用 Mercurial-4.0.2。我们可以通过在克隆 URL 中附加分支名称和 # 符号来指定分支名称。
例如
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.