Git send-email with format-patch

3 December 2022, on Olivier's log

[Update 2023] Git send-email without format-patch

My outdate workflow using format-patch is still available here, but I strongly recommend switching to the workflow above.

Git ships with built-in tools for collaborating over email. Sourcehut made a decent tutorial for it:

I was successful following the tutorial and submitting a couple of patches. However after a couple of mistakes, here is my own workflow for working with git send-email:

Enter format-patch

It happens quite often, that I make a mistake at some step of "git send-email" and cancel the command. However it means that all my message is lost, which I found very frustrating. So now call "git format-patch" to create the patch file, edit it with my editor and then send the email:

# Check existing git config and adjust settings
git config --get-regex "^format\..*"
git config ""
git config format.subjectprefix "PATCH project"

# Submit a patch
git format-patch origin/master
$EDITOR 0001-XXX.patch
git send-email 0001-XXX.patch
rm 0001-XXX.patch

Yes, it means that I have to use 4 commands instead of one. However if anything fails, I can resume from where I left.