【问题标题】:Mercurial will not let me push. Abort: push creates new remote headMercurial不会让我推动。中止:推送创建新的远程头
【发布时间】:2015-01-20 20:50:48
【问题描述】:

我无法使用 mercurial 推送,它表明我必须合并。如果我进行 hg 合并,它会将我的分支与主干合并,我真的想避免这种情况。

我创建并修改了一些文件。我做了 hg add 来添加它们。我做了一些提交,但它不会让我将它们推送到我的分支。

我在下面发布了我的 hg 命令输出:

C:\Users\kacalica\Desktop\Projects\hydroinformatics>hg incoming
comparing with https://stcalica@bitbucket.org/nickrsan/hydroinformatics
searching for changes
no changes found

C:\Users\kacalica\Desktop\Projects\hydroinformatics>hg status
M hydro\forms.py
? graph_test.py
? hydro\mlgraph\__init__.py
? hydro\mlgraph\test.py
? hydro\plugins\__init__.py.orig
? hydro\urls.py.orig
? hydro\views.py.orig
? public\Hydroinformatics\media\test.txt
? public\Hydroinformatics\media\test_EPALM1I.txt
? public\Hydroinformatics\media\test_OIWsXcC.txt
? public\Hydroinformatics\media\test_v5s6RmF.txt

C:\Users\kacalica\Desktop\Projects\hydroinformatics>hg add
adding graph_test.py
adding hydro\mlgraph\__init__.py
adding hydro\mlgraph\test.py
adding hydro\plugins\__init__.py.orig
adding hydro\urls.py.orig
adding hydro\views.py.orig
adding public\Hydroinformatics\media\test.txt
adding public\Hydroinformatics\media\test_EPALM1I.txt
adding public\Hydroinformatics\media\test_OIWsXcC.txt
adding public\Hydroinformatics\media\test_v5s6RmF.txt

C:\Users\kacalica\Desktop\Projects\hydroinformatics>hg push
pushing to https://stcalica@bitbucket.org/nickrsan/hydroinformatics
searching for changes
abort: push creates new remote head b54ae56acf07 on branch 'WITHOUTPLUGINSGRAPHS'!
(merge or see "hg help push" for details about pushing new heads)

C:\Users\kacalica\Desktop\Projects\hydroinformatics>hg commit -m "added files"
abort: last update was interrupted
(use 'hg update' to get a consistent checkout)

C:\Users\kacalica\Desktop\Projects\hydroinformatics>hg update
0 files updated, 0 files merged, 0 files removed, 0 files unresolved

C:\Users\kacalica\Desktop\Projects\hydroinformatics>hg branch
WITHOUTPLUGINSGRAPHS

C:\Users\kacalica\Desktop\Projects\hydroinformatics>hg status
M hydro\forms.py
A graph_test.py
A hydro\mlgraph\__init__.py
A hydro\mlgraph\test.py
A hydro\plugins\__init__.py.orig
A hydro\urls.py.orig
A hydro\views.py.orig
A public\Hydroinformatics\media\test.txt
A public\Hydroinformatics\media\test_EPALM1I.txt
A public\Hydroinformatics\media\test_OIWsXcC.txt
A public\Hydroinformatics\media\test_v5s6RmF.txt

C:\Users\kacalica\Desktop\Projects\hydroinformatics>hg summary
parent: 36:b54ae56acf07 tip
 actually added template
branch: WITHOUTPLUGINSGRAPHS
commit: 1 modified, 10 added
update: 10 new changesets, 2 branch heads (merge)

C:\Users\kacalica\Desktop\Projects\hydroinformatics>

【问题讨论】:

标签: mercurial


【解决方案1】:

好的,首先,让我们在这里整理一下我们的术语。在 Mercurial 中,“头”是没有子变更集的变更集 (https://www.mercurial-scm.org/wiki/Head)。假设您在默认分支中工作。如果您被告知推送会创建新的远程头,这意味着远程存储库(您要推送到的那个)上默认存在不同的头版本。如果你推送,默认会有两个修订版!

这是怎么发生的?好吧,可能是另一个开发人员同时进行了推送,或者您错误地从另一个存储库/计算机推送。您不想推送具有多个头的分支,否则您最终会得到一些带有大量头的疯狂 hydra,其中没有一个包含所有代码。

首先,您需要从远程存储库中提取。接下来,您需要运行“hg merge”——如果您使用的是 Hg-Workbench 或类似工具,您可能不会立即看到另一个头,因此向下滚动并找到它。如果你有冲突,现在是解决它们的时候了。确保你提交了你的合并,然后你应该能够推送。

【讨论】:

    【解决方案2】:

    如果您使用的是不超过几年的 Mercurial 版本,请执行以下操作:hg push --new-branchhg help push 显示可让您推送新分支:

    --new-branch            allow pushing a new branch
    

    只有在您第一次推送新分支时才需要这样做——它只是为了确保您不会意外推送您不想分享的内容。

    【讨论】:

    • 会一切恢复正常,还是我会发生一些奇怪的太头的分支事情?大声笑
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多