Since I’m involved in Buildroot development, I have to send patch series to BR mailings-list frequently. Quilt was my friend for all this time. But the whole procedure has some disadvantages like using e-mail client and defining subject string etc.
Git provides very flexible environment with format-patch and send-email commands. With the first one you can specify which commits should exported as patches.
git format-patch origin/master
will extract all commits since the last push. If you just want to extract only 2 latest commits of your 5 commits execute:
git format-patch -2
If you’re sending reworked patches, it is important to show the version of this patch set. This can be done with –subject-prefix.
git format-patch --subject-prefix="PATCH v2" origin
will add [PATCH v2 x/y] before your real subject.
The patches will be sent via git send-email command, where you can specify what patches should be sent to whom.
git send-email –firstname.lastname@example.org –email@example.com 0001-foo.patch
With –compose switch you can add a summary to the whole path set.
The above commands let you format and send the finished patches. But how to rework the patch in the middle or the whole patch set? The answer is git rebase. With
git rebase -i origin/master you can interactively mark the patches to change or change the order of patches etc. Please refer to this section of “Git Community Book” for further details about git rebase.
Happy gitting ;-)