简体   繁体   English

水银分支和合并,而无需推送分支

[英]Mercurial branching and merging without having to push branch

Here is what I'm trying to do: 这是我想要做的:

  1. hg clone http://www.my_repo.com 汞克隆http://www.my_repo.com
  2. hg branch new_branch hg分支new_branch
  3. hg update new_branch # move to new branch hg update new_branch #移至新分支
  4. do some changes in branch code 在分支代码中进行一些更改
  5. hg commit -m 'changes in branch new_branch' hg commit -m'分支new_branch中的更改'
  6. hg update default # move back to default branch hg update default #返回默认分支
  7. hg merge new_branch # merge new_branch into default to have changes added in default hg merge new_branch #将new_branch合并为默认值以在默认值中添加更改
  8. hg commit -m 'merging' hg commit -m“合并”
  9. hg push 汞推

But at this point, mercurial is forcing me to do hg push --new-branch to add the branch to the remote repository. 但是在这一点上,mercurial迫使我执行hg push --new-branch将分支添加到远程存储库。 I don't want the branch in the repo, I just want to create a branch locally, do all the changes I wanna do, then when I'm ready to merge, move to default, pull and update changes on default (any other person might have added changes on default) and finally merge my branch into default, and making new_branch dissapear of possible, because I won't need it anymore once it's merged into default. 我不希望该仓库中的分支,我只想在本地创建一个分支,执行我想做的所有更改,然后当我准备合并,移动到默认设置,拉取和更新默认设置(其他任何更改)时可能会在默认值上添加更改),最后将我的分支合并到默认值中,并使new_branch消失,因为一旦合并到默认值后,我将不再需要它。

What am I doing wrong, I come from git if you haven't noticed. 我做错了,如果您没有注意到,我来自git。

For what you're doing you want a 'bookmark' not a 'branch'. 对于您正在做的事情,您想要一个“书签”而不是“分支”。 In Mercurial a branch is called a "named branch" and every changeset is on one and only one named branch. 在Mercurial中,一个分支称为“命名分支”,每个变更集都在一个且只有一个命名分支上。 That branch name is part of the commit and included in the commit's hash. 该分支名称是提交的一部分,并包含在提交的哈希中。 When you've created commits with a specific branch name burned into them you can't push them (or their descendants) without that branch name going with them. 创建带有特定分支名称的提交后,如果没有该分支名称,就无法推送它们(或它们的后代)。

A bookmark on the other hand is just a pointer to a commit. 另一方面,书签只是指向提交的指针。 It moves forward on commit -- in other words very much like what git calls a branch ( cough throwing 20 years of terminology out the window :). 它会在提交时继续前进-换句话说,就像git所说的分支一样( 咳嗽将20年的术语扔到了窗外:)。

Substitute bookmark for branch in your commands above and everything will work pretty much exactly like you'd imagine. 在上面的命令中用书签替换分支,一切将完全按照您的想象进行。

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

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