[英]Pushing to remote repository after merge “creates new remote heads” - is that bad?
I initialized
a Mercurial project on Machine A
, committed
my changes and uploaded
them to a remote repository. 我在Machine A
上initialized
了一个Mercurial项目, committed
我的更改并将它们uploaded
到远程存储库。
Then I cloned
that repository on Machine B
, committed
some additional changes and uploaded
them to the same remote repository. 然后我cloned
了Machine B
上的存储库, committed
一些额外的更改并将它们uploaded
到同一个远程存储库。
In both cases, I uploaded the changes with the same command: 在这两种情况下,我都使用相同的命令上传了更改:
hg push https://username:password@domain/user/repository/
Now I'm back on Machine A and I've pull
ed from the remote repository and merg
ed any changes between the two changesets using the KDiff3
GUI tool using the commands: 现在我回来了计算机A上,我已经pull
从远程仓库ED和merg
编使用两个变更集之间的任何变化KDiff3
使用命令GUI工具:
hg pull
hg merge
hg commit
However, when I try to push the latest changes from Machine A back to the remote repository after this pull and merge, I get this message: 但是,当我尝试在此拉取和合并之后将最新的更改从机器A推回到远程存储库时,我收到以下消息:
hg push https://username:password@domain/user/repository/
pushing to https://username:password@domain/user/repository/
searching for changes
abort: push creates new remote heads!
(did you forget to merge? use push -f to force)
Why does it say "did you forget to merge"? 为什么会说“你忘了合并”? -- I completed the merge. - 我完成了合并。
Is it bad to force the push and create "new remote heads"? 强迫推动并创造“新的遥控头”是不是很糟糕?
If so, how do I avoid this? 如果是这样,我该如何避免这种情况?
UPDATE: 更新:
I ran " hg merge
" again and got this output: 我再次运行“ hg merge
”并获得此输出:
5 files updated, 1 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg up --clean' to abandon
So I ran ' hg up --clean
' and it reported: 所以我跑了' hg up --clean
',它报告说:
6 files updated, 0 files merged, 1 files removed, 0 files unresolved
Now when I type ' hg heads
', it says: 现在当我输入' hg heads
'时,它说:
changeset: 11
tag: tip
parent: 9
user: eggdrop
date: Tue Oct 20 16:27:44 2009 -0400
summary: Machine A after merge
changeset: 10
parent: 7
user: chickensoup
date: Thu Oct 15 03:27:23 2009 -0400
summary: Machine B changes to be pulled onto Machine A
You ran hg up --clean
. 你跑了hg up --clean
。 That means you undid the merge, which means you still need to merge. 这意味着你取消了合并,这意味着你仍然需要合并。 You have an unresolved file when you merge. 合并时有一个未解析的文件。 Re-read your error message: 重新阅读您的错误消息:
5 files updated, 1 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg up --clean' to abandon
You need to resolve the merge conflict and then complete the merge with hg resolve
. 您需要解决合并冲突,然后使用hg resolve
完成合并。 Then you will have successfully merged your two heads. 然后你将成功合并你的两个脑袋。
And to answer your question: no, it's not bad to have two remote heads. 并回答你的问题:不,有两个遥控头也不错 。 It just means you need to merge them (preferably ASAP) before you push anything else to the remote server. 它只是意味着您需要在将任何其他内容推送到远程服务器之前将它们合并(最好是ASAP)。
So to fix, just run hg merge
, resolve the one conflict, then run hg resolve
. 所以要修复,只需运行hg merge
,解决一个冲突,然后运行hg resolve
。
First: View your changes with hg log
. 第一:使用hg log
查看您的更改。 The following didn't help in my case: 以下对我的案例没有帮助:
hg pull
and hg merge
(before you pull check against hg incoming) hg pull
和hg merge
(在你检查hg传入之前) hg pull --rebase
或者: hg pull --rebase
But this helped. 但这有帮助。
hg merge [revision]
I found that I needed to explicitly merge some revisions which looked like heads. 我发现我需要明确合并一些看起来像头的修订版。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.