Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keeping gpg signature in git patches with format-patch

I generally sign my commits with gpg keys. However, there are certain times that I need to send my patches through email, which I achieve by using git-format-patch and git-send-email. However, this results in my GPG signatures removed from the patch. My goal is to have someone else actually apply the patches to repository and send it, also preserving my signature so authenticity of the code is ensured.

By using git-am, the committer is creating a new hash, thus new commit So I'm not certain that the signature would even work I'm not sure what goes into gpg for signing, only the diff, maybe? If that's the case, I guess this would work. Is this possible?

I've looked at git documentation on git-format-patch and It seems there's a --signature option, which is not very well documented, I've tried doing a couple of things to attach a signature to patches, but none of them survived into the destination git repository. What's the correct way of using it?

And finally, even if adding --signature achieves what I'm trying achieve, it might be cumbersome when creating a series of patches and sending them via email. Is there a batch option that simply attaches the signature which I can clearly see attached to commits with git cat-file -p <HASH>, to the patches generated with git-format-patch?

Thanks

like image 262
Akaedintov Avatar asked Oct 29 '22 01:10

Akaedintov


1 Answers

I don't think git-format-patch can preserve signatures. You may try git bundle; it certainly preserves everything; but it's not as convenient to send over email.

like image 62
phd Avatar answered Nov 15 '22 06:11

phd