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

标签 git

这个问题在这里已经有了答案:





How to identify conflicting commits by hash during git rebase?

(8 个回答)


3年前关闭。




鉴于以下(有点人为的)情况 - 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

checkout 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 此提交,因为我的更改是一个临时解决方法,无论如何我都想扔掉。

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

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

最佳答案

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

git rebase -i <other_branch>

关于git - 在 rebase 中,我能看到当前提交的提交信息吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47038568/

相关文章:

git - 在 Gitkraken diff 窗口中显示整个文件

git - 使用带有 Dymola/Modelica 的 git 进行版本控制

git - 在 vim 航空公司中,只显示 git 分支,不更改文件

git - 警告 : remote HEAD refers to nonexistent ref, 无法 checkout

git - 如何在 1.8.3 中 Git stash pop specific stash?

用于元数据存储/检索的 Git Hook

git - 从远程 git 存储库中查找最新的 git 标签

node.js - GitLab CI 使用 Node 测试 master 和 branch 之间的差异

git - stash 然后 pop 在 git 中执行自动提交

git - 如何构建特定版本的 Chromium?