How to use git am to apply patches from email messages? How to use git am to apply patches from email messages? git git

How to use git am to apply patches from email messages?


The other big thing involved is git format-patch. This will create the patches to be emailed; they can then be sent using git send-email or directly. For example:

# create a patch for each commit from origin's master to yoursgit format-patch origin/master..master# now send them... # there are a zillion options here, and also some configuration; read the man pagegit send-email --to=maintainer@project.com --from=me@here.com ... *.patch

git am will accept the patches created by format-patch, and apply them sequentially, for example:

git am *.patch

You'll have to figure out how to export the patches in mbox format from your mail client yourself, though I suppose you could also simply send them as attachments or transfer them directly.

You can try this out for yourself entirely within one repository to see how it works. Create a set of patches as above, then check out the starting point, and use git am to apply the patches.


Patchwork workaround

https://github.com/getpatchwork/patchwork

Since no one seems to know how to convert emails to mbox with readily available tools, many of those cornerstone dinosaur projects projects have an associated, sometimes officially recommended, patchwork instance running, many of them hosted on https://patchwork.ozlabs.org/ e.g.:

Patchwork subscribes to the list, and parses the patches generated by git send-email, and allows you to download a patch.

So yes, yet another tooling layer on top of email...

Thunderbird export to mbox

Asked at: What is the easiest way to apply git series of patches from Thunderbird No answer so far.

See also


You need a mail client that can export mail as mbox file. Export the mails and run git-am your-mbox-file. It's done.