如果正在进行rebase,我可以看到当前提交的提交消息吗?

时间:2017-10-31 15:04:56

标签: git

考虑到以下(稍微有点做作)的情况 - 3次提交他们的提交消息,其中我提交2个提交我的origin / master并希望rebase:

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

签出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".

此时,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...

为了帮助我了解我目前正在查看哪个提交的上下文,我希望看到我正在进行重新定位的提交的完整消息

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

告诉你冲突的消息只给出了消息“第二次提交”的第一行,而不是带有有用子弹点的正文。

这可能吗?我可以看到它可能是奇怪的,因为在我处于rebase中间的位置,提交尚未存在,但同样地,消息必须存在于某处,因为当我解决冲突并且{ {1}},将应用原始提交消息。

1 个答案:

答案 0 :(得分:1)

因此,您希望查看导致冲突的提交消息。好吧,你可以做互动的rebase。它始终显示出现错误的提交ID和名称。

git rebase -i <other_branch>