简体   繁体   English

Mercurial:从主存储库添加分支

[英]Mercurial: Add branch from master repository

I have a forked project, and now the master repository has added a new branch which I want on my forked project. 我有一个分叉项目,现在主存储库在我的分叉项目中添加了一个我想要的新分支。

Is it best practice to add the branch locally and then merge from the master repository, or is there a more correct way of doing this? 最佳做法是在本地添加分支,然后从主存储库进行合并,还是有更正确的方法来执行此操作?

My guess is this, but I don't want to mess things up: 我猜这是,但我不想搞砸了:

hg branch theNewBranch
hg pull -r theNewBranch ssh://hg@bitbucket.org/master_repository/theproject
hg merge 0011223344ff
hg commit -m "Merged in master repository branch"

There's no need to add it locally. 没有必要在本地添加它。 Every commit has the branch it is on burned into it. 每个提交具有分它是了进去。 If they have a commit on theNewBranch you'll get it. 如果他们在theNewBranch上有一个提交你就会得到它。

If you want everything they have mirrored locally just do: 如果你想要在本地镜像的所有东西,只需:

hg pull ssh://hg@bitbucket.org/master_repository/theproject

And if you want to merge in into your local branch do: 如果你想合并到你的本地分支做:

hg checkout mylocalbranch
hg merge theNewBranch

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM