合并后无法推送到远程仓库

发布于 2024-11-15 02:21:58 字数 856 浏览 0 评论 0原文

分支出去 -

[default]$ hg branch talks
[talks]$ <... some commits ...>
[talks]$ hg update default

合并回来 -

[default]$ hg merge talks
3 files updated, 0 files merged, 0 files removed, 0 files unresolved

推送到远程仓库 -

[default]$ hg commit -m "merging talks to default"
[default]$ $ hg push
abort: push creates new remote branches: talks!
(use 'hg push --new-branch' to create new remote branches)

进一步调查显示远程仓库不希望我在远程端有多个头。但我只是做了一次合并,将两个头合并为一个,不是吗?

来自 hgserve 的图表似乎也同意我的观点(我希望) 在此处输入图像描述

但是,我还看到来自 hg faces 的两个头像

[default]$ hg branches
default                        9:85752ecd6326
talks                          8:2b00714d76d5 (inactive)

branching out -

[default]$ hg branch talks
[talks]$ <... some commits ...>
[talks]$ hg update default

merging back -

[default]$ hg merge talks
3 files updated, 0 files merged, 0 files removed, 0 files unresolved

pushing to remote repo -

[default]$ hg commit -m "merging talks to default"
[default]$ $ hg push
abort: push creates new remote branches: talks!
(use 'hg push --new-branch' to create new remote branches)

Further investigation revealed that remote repo doesn't want me to have multiple heads at the remote end. But I just did a merge to merge the two heads into one, isn't it?

The graph from hg serve also seems to agree with me (I hope)
enter image description here

However, I also see two heads from hg heads

[default]$ hg branches
default                        9:85752ecd6326
talks                          8:2b00714d76d5 (inactive)

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

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

发布评论

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

评论(2

往日情怀 2024-11-22 02:21:58

解决方案在中止消息中:use 'hg push --new-branch'。您已经创建了一个名为 talks 的命名分支,因此它需要这个额外的开关,无论您是否已将命名分支合并回默认状态。

The solution is in the abort message: use 'hg push --new-branch'. You've created a named branch called talks so it needs this extra switch, regardless if you have merged the named branch back to default.

死开点丶别碍眼 2024-11-22 02:21:58

我猜您误解了分支功能。您刚刚创建了一个分支,其名称将永远存在于存储库中。我怀疑你并不是真的想这么做。您可能想要研究本地分支的书签功能,这些分支的名称最终不会永远存在于存储库中。

Mercurial 会拒绝将新的全局分支名称添加到要推送到的存储库中,因为这很少是您真正想要做的事情。 hg push --new-branch 将告诉 Mercurial 是的,您确实打算这样做。

您看到的两个头具有误导性。请注意其中一个头如何被列为“(非活动)”。这仅意味着这是全局分支上的最后一个更改,但不是实际的头部。您经常希望看到分支的头,即使这些头实际上有子项并且不是真正的头。

顺便说一句......我不久前编写了将该功能添加到“heads”命令中的代码。 :-)

I'm guessing you've misunderstood the branch feature. You've just created a branch who's name will live forever in the repository. I suspect you didn't really want to do this. You might want to investigate the bookmarks feature for local branches that don't end up with names that live forever in the repository.

Mercurial balks at pushes that add new global branch names to the repository being pushed to because that's so very rarely what you really want to do. hg push --new-branch will tell Mercurial that yes, you really mean to do that.

The two heads you're seeing are misleading. Notice how one head is listed as '(inactive)'. That just means it's the last change on the global branch, but not an actual head. You frequently want to see the heads of branches, even if those heads actually have children and are not really heads.

As a small aside... I wrote the code that added that feature to the 'heads' command awhile back. :-)

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