更新时间:2022-11-03 10:08:39
在不更改提交ID的情况下不能更改提交消息,因为提交消息是哈希形成提交ID的数据的一部分。
You cannot change a commit message without changing the commit id because the commit message is part of the data that is hashed to form the commit id.
这就是为什么所有改变单个提交的工具通常会更改所有后续提交( filter-branch
, rebase
等),因为一旦你改变了历史中的一个提交,所有的后代必须改变,因为它们有一个带有新ID的新祖先。
This is why all the tools which change a single commit generally change all the subsequent commits (filter-branch
, rebase
, etc.) because once you change one commit in a history all the descendants must change because they have a new ancestor with a new id.