How to retain commit gpg-signature after interactive rebase squashing?

后端 未结 3 1290
没有蜡笔的小新
没有蜡笔的小新 2020-12-08 00:52

When I want to squash some commits by interactive rebase:

git rebase -i HEAD~3

And then:

pick cbd03e3 Final co         


        
3条回答
  •  悲&欢浪女
    2020-12-08 01:23

    It doesn't make sense that you would be able to. The whole point of a gpg signature is to verify that code hasn't been tampered with. If you could keep the signature after modifying the history, that would defeat the whole purpose.

    I don't currently sign my Git code with gpg so I don't know the exact details, but I guess it probably hashes the final commit object of a tree. When you rebase like in your example, the Final commit will have a different sha1 ID, so it's not the same object as before the rebase, so having the same gpg signature is probably impossible, and like I said, it wouldn't make sense.

提交回复
热议问题