合并后推送到远程存储库“创建新的远程头". - 那不好吗? [英] Pushing to remote repository after merge "creates new remote heads" - is that bad?
问题描述
-
我
initialized
在Machine A
上的Mercurial项目,committed
我的更改并将uploaded
更改到远程存储库.
I
initialized
a Mercurial project onMachine A
,committed
my changes anduploaded
them to a remote repository.
然后我cloned
在 Machine B
上的那个存储库,committed
进行一些其他更改,然后uploaded
将它们存储到同一远程存储库.
Then I cloned
that repository on Machine B
, committed
some additional changes and uploaded
them to the same remote repository.
在两种情况下,我都使用相同的命令上传更改:
In both cases, I uploaded the changes with the same command:
hg push https://username:password@domain/user/repository/
现在,我回到计算机A上,并通过KDiff3
GUI工具使用以下命令从远程存储库中pull
进行了merg
两个变更集之间的所有更改:
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:
hg pull
hg merge
hg commit
但是,当我在此合并合并后尝试将最新的更改从Machine A推送回远程存储库时,会收到以下消息:
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:
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)
为什么说您忘记合并了"? -我完成了合并.
强制推送并创建新的远程磁头"是否很糟糕?
如果是,该如何避免呢?
更新:
我再次运行"hg merge
"并获得以下输出:
I ran "hg merge
" again and got this output:
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
所以我运行了'hg up --clean
',它报告了:
So I ran 'hg up --clean
' and it reported:
6 files updated, 0 files merged, 1 files removed, 0 files unresolved
现在,当我键入'hg heads
'时,它说:
Now when I type 'hg heads
', it says:
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
推荐答案
您运行了hg up --clean
.这意味着您取消了合并,这意味着您仍然需要合并.合并时您有一个未解决的文件.重新阅读您的错误消息:
You ran 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
您需要解决合并冲突,然后使用hg resolve
完成合并.然后,您将成功合并两个头.
You need to resolve the merge conflict and then complete the merge with 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.
要解决此问题,只需运行hg merge
,解决一个冲突,然后运行hg resolve
.
So to fix, just run hg merge
, resolve the one conflict, then run hg resolve
.
这篇关于合并后推送到远程存储库“创建新的远程头". - 那不好吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!