git 修复:获取原始提交的哈希值

git fixup: get hash of original commit

git rebase -i --autosquash 如何知道与修正关联的原始提交? git commit --fixup 创建的唯一“元数据”似乎是日志消息(“修正!” + 原始消息)。原始提交散列未存储在修复提交中的任何位置(至少,我无法从 git show --raw 中得知)。

那么给定修复提交,我怎样才能找到被修复的原始提交?

我问是因为 git rebase 仍然 想要你输入一个提交哈希,即使它应该从我想要的修复中暗示 <original-hash>^ ;也许别名是有序的。

引用 the doc :

--autosquash
--no-autosquash

When the commit log message begins with "squash! …​" (or "fixup! …​"), and there is already a commit in the todo list that matches the same ..., automatically modify the todo list of rebase -i so that the commit marked for squashing comes right after the commit to be modified, and change the action of the moved commit from pick to squash (or fixup).

[emphasis mine : ]
A commit matches the ... if the commit subject matches, or if the ... refers to the commit’s hash.

As a fall-back, partial matches of the commit subject work, too. The recommended way to create fixup/squash commits is by using the --fixup/--squash options of git-commit[1].

请注意,“提交主题”是指“提交消息的第一行”——而不是“完整的提交消息”。