git 中提交之间的签核

Signoff previous in between commits in git

我有一个分支,其中有多个提交如下

Commit 1 - Not signed
Commit 2 - Signed off X
Commit 3 - Not signed
Commit 4 - Not signed
Commit 5 - Signed off by Y

我想签署提交 1、3、4。这些是我创建但错过的签名

当我尝试使用

git rebase HEAD~3 --signoff

它正在签署已经由 X 签署的提交编号 2。

有什么方法可以让我们专门签署特定的提交。

如果只有几个提交,请使用 interactive rebase,将这些提交设置为编辑,并对每个提交设置 git commit --amend --signoff

使用交互式变基 + --exec:

git rebase -i -x "git commit --amend --no-edit --signoff" HEAD~3

git rebase -i 向您显示其待办事项文件时,从提交 2 下删除 exec 行。保留所有其他命令(pickexec)不变。保存并 git rebase -i 将 运行 完全自动为您执行命令。

PS。备份仓库。