重写Git历史记录:如何删除签名?

Man*_*rum 4 git

重写Git存储库的历史记录时,如何删除签名(由git commit -sor 创建git commit --signoff)?

git filter-branchcommit-filter似乎只支持使用的变量git commit-tree:

GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL
GIT_AUTHOR_DATE
GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL
GIT_COMMITTER_DATE
EMAIL
Run Code Online (Sandbox Code Playgroud)

Bri*_*ell 13

Sign offs are just part of the message body. So, you'll want to use git filter-branch --msg-filter to run a command to find lines starting with Signed-off-by: and remove them.

Something like

git filter-branch --msg-filter "sed /^Signed-off-by:/d"
Run Code Online (Sandbox Code Playgroud)

should do the trick.