git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 2/3] MyFirstContribution: recommend the use of b4

From
Patrick Steinhardt <ps@pks.im>
Date
Jun 15, 2026, 12:59 UTC
Message-ID
<20260615-pks-b4-v4-2-22cfca8f19c5@pks.im>
In-Reply-To
<20260615-pks-b4-v4-0-22cfca8f19c5@pks.im>

The b4 tool originates from the Linux kernel community and is intended to help mailing-list based workflows. It automates a lot of the annoying bookkeeping tasks that contributors typically need to do: tracking the list of recipients, Message-IDs, range-diffs and the like. In addition to that, b4 also has many other subcommands that help the maintainer and reviewers.

The Git project uses the same infrastructure as the kernel, so this tool is also a very good fit for us. Adapt "MyFirstContribution" to explicitly recommend its use.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/MyFirstContribution.adoc | 92 ++++++++++++++++++++++++++++++++--
 Documentation/SubmittingPatches        |  6 ++-
 2 files changed, 93 insertions(+), 5 deletions(-)
diff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc
index 984b7f5aa8..607876f3d8 100644
--- a/Documentation/MyFirstContribution.adoc
+++ b/Documentation/MyFirstContribution.adoc
@@ -833,7 +833,7 @@ This patchset is part of the MyFirstContribution tutorial and should not
 be merged.
 ----
 
-At this point the tutorial diverges, in order to demonstrate two
+At this point the tutorial diverges, in order to demonstrate three
 different methods of formatting your patchset and getting it reviewed.
 
 The first method to be covered is GitGitGadget, which is useful for those
@@ -845,9 +845,14 @@ more fine-grained control over the emails to be sent. This method requires some
 setup which can change depending on your system and will not be covered in this
 tutorial.
 
+The third method to be covered is `b4`, which builds on top of `git
+format-patch` and `git send-email`. This method is the recommended way to
+submit patches via mail as it automates a lot of the bookkeeping required by
+`git send-email`.
+
 Regardless of which method you choose, your engagement with reviewers will be
-the same; the review process will be covered after the sections on GitGitGadget
-and `git send-email`.
+the same; the review process will be covered after the sections on GitGitGadget,
+`git send-email` and `b4`.
 
 [[howto-ggg]]
 == Sending Patches via GitGitGadget
@@ -1296,6 +1301,87 @@ index 88f126184c..38da593a60 100644
 2.21.0.392.gf8f6787159e-goog
 ----
 
+[[howto-b4]]
+== Sending Patches with `b4`
+
+`b4` is a tool that builds on top of `git format-patch` and `git send-email`.
+It automates much of the bookkeeping involved in sending a patch series to a
+mailing-list-based project.
+
+Refer to the https://b4.docs.kernel.org/[b4 documentation] for a full reference.
+
+[[prep-b4]]
+=== Preparing a Patch Series
+
+`b4` tracks your patch series as a branch. To start tracking the `psuh` branch
+you have been working on, run:
+
+----
+$ b4 prep --enroll master
+----
+
+This enrolls the current branch, using `master` as the base of the topic. `b4`
+manages the cover letter as part of the branch, so you can edit it at any time
+with:
+
+----
+$ b4 prep --edit-cover
+----
+
+The cover letter not only tracks the content of the top-level mail, but also
+the set of recipients. You can add recipients by adding `To:` and `Cc:`
+trailer lines.
+
+[[send-b4]]
+=== Sending the Patches
+
+Before sending the series out for real, you can inspect what `b4` would send by
+passing `--dry-run`:
+
+----
+$ b4 send --dry-run
+----
+
+Once you are happy with the result, send the series with:
+
+----
+$ b4 send
+----
+
+[[v2-b4]]
+=== Sending v2
+
+When you are ready to send a new iteration of your series, refine your
+patches as usual using linkgit:git-rebase[1]. Note that you typically want to
+rebase on top of the cover letter. You can configure an alias to enable easy
+rebases going forward:
+
+---
+$ git config set alias.b4-rebase 'rebase "HEAD^{/--- b4-submit-tracking ---}"'
+$ git b4-rebase -i
+---
+
+Before sending out the new version you should also update the cover letter with
+`b4 prep --edit-cover` to note the relevant changes compared to the previous
+version. You can inspect the changes between the two versions with `b4 prep
+--compare-to=v1`.
+
+Same as with the first version, you can use `b4 send` to send out the second
+version. `b4` automatically bumps the version to `v2`, generates the range-diff
+against the previous iteration, and threads the new series as a reply to the
+cover letter of the first version.
+
+[[configure-b4]]
+=== Configure b4
+
+`b4` can be configured via linkgit:git-config[1]. In addition to that, projects
+can have their own set of defaults in `.b4-config` in the root tree, which also
+uses Git's config format. The user's configuration always takes precedence over
+the per-project defaults.
+
+Refer to the https://b4.docs.kernel.org/en/latest/config.html[b4 config documentation]
+for more information on the available options.
+
 [[now-what]]
 == My Patch Got Emailed - Now What?
 
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index d570184ec8..99427e1ee1 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -573,8 +573,10 @@ your existing e-mail client (often optimized for "multipart/*" MIME
 type e-mails) might render your patches unusable.
 
 NOTE: Here we outline the procedure using `format-patch` and
-`send-email`, but you can instead use GitGitGadget to send in your
-patches (see link:MyFirstContribution.html[MyFirstContribution]).
+`send-email`, but you can instead use GitGitGadget or `b4` to send in
+your patches (see link:MyFirstContribution.html[MyFirstContribution]).
+Contributors are encouraged to use `b4`, which automates much of the
+bookkeeping that is otherwise done by hand.
 
 People on the Git mailing list need to be able to read and
 comment on the changes you are submitting.  It is important for
-- 
2.55.0.rc0.738.g0c8ab3ebcc.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 52 of 54 in “Documentation: recommend the use of b4”
  1. 0/2 Documentation: recommend the use of b4Patrick Steinhardt, Jun 2, 2026
  2. 1/2 b4: introduce configuration for the Git projectPatrick Steinhardt, Jun 2, 2026
  3. Junio C HamanoJun 2, 2026
  4. Patrick SteinhardtJun 2, 2026
  5. Ramsay JonesJun 2, 2026
  6. Junio C HamanoJun 3, 2026
  7. Patrick SteinhardtJun 3, 2026
  8. Tuomas AholaJun 2, 2026
  9. Weijie YuanJun 3, 2026
  10. Patrick SteinhardtJun 3, 2026
  11. Weijie YuanJun 3, 2026
  12. Weijie YuanJun 3, 2026
  13. SZEDER GáborJun 3, 2026
  14. Weijie YuanJun 3, 2026
  15. Tuomas AholaJun 3, 2026
  16. Junio C HamanoJun 4, 2026
  17. Patrick SteinhardtJun 8, 2026
  18. Patrick SteinhardtJun 8, 2026
  19. 2/2 Documentation/MyFirstContribution: recommend the use of b4Patrick Steinhardt, Jun 2, 2026
  20. Weijie YuanJun 2, 2026
  21. Patrick SteinhardtJun 3, 2026
  22. Weijie YuanJun 3, 2026
  23. Weijie YuanJun 3, 2026
  24. 0/3 Documentation: recommend the use of b4Patrick Steinhardt, Jun 3, 2026
  25. 1/3 Documentation/MyFirstContribution: recommend shallow threadingPatrick Steinhardt, Jun 3, 2026
  26. Tuomas AholaJun 3, 2026
  27. Patrick SteinhardtJun 8, 2026
  28. Weijie YuanJun 3, 2026
  29. Patrick SteinhardtJun 8, 2026
  30. Weijie YuanJun 8, 2026
  31. Kristoffer HaugsbakkJun 3, 2026
  32. Patrick SteinhardtJun 8, 2026
  33. 2/3 Documentation/MyFirstContribution: recommend the use of b4Patrick Steinhardt, Jun 3, 2026
  34. Toon ClaesJun 4, 2026
  35. Patrick SteinhardtJun 8, 2026
  36. 3/3 b4: introduce configuration for the Git projectPatrick Steinhardt, Jun 3, 2026
  37. Toon ClaesJun 3, 2026
  38. Patrick SteinhardtJun 8, 2026
  39. 0/3 Documentation: recommend the use of b4Patrick Steinhardt, Jun 8, 2026
  40. 1/3 MyFirstContribution: recommend shallow threading of cover lettersPatrick Steinhardt, Jun 8, 2026
  41. Karthik NayakJun 10, 2026
  42. Patrick SteinhardtJun 15, 2026
  43. 2/3 MyFirstContribution: recommend the use of b4Patrick Steinhardt, Jun 8, 2026
  44. 3/3 b4: introduce configuration for the Git projectPatrick Steinhardt, Jun 8, 2026
  45. Karthik NayakJun 10, 2026
  46. Patrick SteinhardtJun 15, 2026
  47. Toon ClaesJun 9, 2026
  48. Junio C HamanoJun 9, 2026
  49. Patrick SteinhardtJun 10, 2026
  50. 0/3 Documentation: recommend the use of b4Patrick Steinhardt, Jun 15, 2026
  51. 1/3 MyFirstContribution: recommend shallow threading of cover lettersPatrick Steinhardt, Jun 15, 2026
  52. 2/3 MyFirstContribution: recommend the use of b4Patrick Steinhardt, Jun 15, 2026
  53. 3/3 b4: introduce configuration for the Git projectPatrick Steinhardt, Jun 15, 2026
  54. Toon ClaesJun 16, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.