3

I use gerrit at my job, and it requires use of rebase instead of merge commits. Today I checked out a previous commit using its hash value, and when I ran the git branch command, I was informed I was on "no branch". I assume this is a detached HEAD? In any case, I rebased against my my master branch, and the console printed

Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...

Where does the '3-way merge' in this situation come from? And was the HEAD still detached after the rebase (considering the 'base-tree' statement)? Thank you.

4

2 回答 2

1

是的,“无分支”表示分离的 HEAD

基础修订来自于做

git merge-base <yourrevision> master

它将查看最后一个共同祖先(或合并点,即使存在手动冲突也被视为共同祖先)以建立基本版本。

在 rebase 之后,你通常总是在一个新的分离 HEAD,IIRC。现在有很多方法可以调用 rebase(包括 --onto --root),它们的行为可能略有不同。因此,如果您愿意发布使用的 rebase 命令,我可能会验证我的想法并添加一些评论。

于 2011-06-02T23:41:03.210 回答
0

如此处所示,此错误消息通常是冲突的迹象:

冲突不会自行消失,但在这种情况下,我们修复冲突并继续,原始补丁“添加另一条消息”将自行更改:

$ vi main.c
$ git add main.c
$ git rebase --continue

关键是修复冲突后继续rebase。

于 2012-11-22T11:37:06.200 回答