在 rebase 中,我能看到当前提交的提交信息吗?

Dav*_*ave 5 git

鉴于以下(有点人为的)情况 - 3 次提交及其提交消息,其中我在我的原点/主控之前 2 次提交并且想要重新设定基准:

C1   <-- origin/master
  first commit

  * Implement the foo

C2
  second commit

  * Wibble the foo
  * This is temporary to workaround the issue with the thingy, and can be removed after Steve applies his fix.

C3   <-- HEAD
  third commit

  * Add the wotsit
Run Code Online (Sandbox Code Playgroud)

随着C3检出的,我做的事:git rebase origin/master和我们说有冲突,所以我看到的是这样的:

First, rewinding head to replay your work on top of it...
Applying: second commit
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging foo.txt
CONFLICT (add/add): Merge conflict in foo.txt
error: Failed to merge in the changes.
Patch failed at 0001 C2
The copy of the patch that failed is found in: .git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
Run Code Online (Sandbox Code Playgroud)

此时,git log将向我显示导致冲突的提交之前的所有提交,直到 C1:

$ git log
commit C1
Author: Me
Date:   Thu Oct 26 16:12:53 2017 +0100

    first commit

    * Implement the foo

commit C0
Author: Someone else
Date:   Wed Oct 25 ...

    etc...
Run Code Online (Sandbox Code Playgroud)

为了帮助我了解当前正在查看的提交的上下文,我想查看 我当前正在重新定位的提交完整消息

在这种情况下,这是提交 C2 的消息,它提醒我我可以安全地 git rebase --skip提交,因为我的更改是一个临时的解决方法,无论如何我都想扔掉。

告诉您有关冲突的消息仅给出消息“第二次提交”的第一行,而不是包含有用要点的正文。

那可能吗?我可以看到这可能很奇怪,因为在我处于 rebase 中间的时候,提交并不真正存在,但同样该消息必须存在于某处,因为当我解决冲突并执行时git rebase --continue,将应用原始提交消息。

hsp*_*her 0

因此,您想查看导致冲突的提交消息。好吧,你可以进行交互式变基。它始终将发生冲突的提交 ID 和名称显示为错误。

git rebase -i <other_branch>
Run Code Online (Sandbox Code Playgroud)