B4(5)
πΈ B4 β the manual page, bestie edition π
okay so you found the B4(5) page, which lives in section 5 (File Formats Manual) and it's literally all about working with code submissions in a public-inbox archive. pull up a chair. π«Ά
β¨ NAME β¨
B4 β work with code submissions in a public-inbox archive. that's the whole vibe check. π
π SYNOPSIS π
b4 {mbox,am,shazam,pr,diff,ty,kr,prep,send,trailers} [options]
π DESCRIPTION π
so b4 is this helper utility that lets you work with patches and pull requests that are made available via a public-inbox archive, like lore.kernel.org. it exists to make it simpler to participate in patch-based workflows β you know, the kind the Linux kernel development crew lives in. π₯
the name "b4" was picked because it's easy to type, and also because B-4 was the precursor to Lore and Data in the Star Trek universe. iconic. no further questions. πβ¨
full documentation lives at <https://b4.docs.kernel.org/> β go read it, it's giving very thorough.
π¦ SUBCOMMANDS π¦
maintainer-oriented π§
mboxβ download a thread as an mbox fileamβ create an mbox file that's ready forgit-amshazamβ apply patch series straight to git repositoriesprβ work with pull requeststyβ create templated replies for processed patches and pull requestsdiffβ show range-diff style diffs between patch versionskrβ (STUB) operate on patatt-compatible keyrings
contributor-oriented πΈ
prepβ prepare your series for submissiontrailersβ retrieve and apply code-review trailerssendβ send your series for review on distribution lists
for the full list of options and what they do, please see b4 --help and b4 subcommand --help. bestie, that's where the details live. π
π¬ b4 mbox
this command lets you retrieve entire threads from a remote public-inbox instance. you can open the resulting mbox file with basically any mail client, so you can reply to conversations or review patch submissions. chef's kiss.
you can hand it the message as a msgid, as a full URL to a public-inbox archive, or you can just pipe it in on stdin. pick your fighter. π
for options and their descriptions, see b4 mbox --help.
Examples β¨
b4 mbox [msgid]
download a thread from the default public-inbox server and save it in the current directory as a .mbox file.
b4 mbox -m ~/Mail [msgid]
download a thread from your ~/Mail folder and save it in the current directlry as a .mbox file.
b4 mbox -fo ~/Mail [public-inbox-url]
download the thread from this public-inbox server, and add it to your existing mailbox, filtering out any dupes already in your mailbox folder. no duplicates in this house. π
π b4 am
this one retrieves threads from a public-inbox instance and gets them all prepped for applying to a git repository with the git am command. it will automatically do the following operations, no notes:
- pick the latest submitted version of the series (it can check for newer threads using
-cas well) - check DKIM signatures and patatt attestation on all patches and code review messages
- collate all submitted code-review trailers (
Reviewed-by,Acked-by, etc) and put them into the commit message - add your own
Signed-off-bytrailer (with-s) - reroll series from partial updates (e.g. someone submits a v2 of a single patch instead of rerolling the entire series)
- guess where in the tree history the patches belong, if the exact commit-base isn't specified (with
-g) - prepare the tree for a 3-way merge (with
-3) - cherry-pick a subset of patches from a large series (with
-P)
Note: unless you actually intend to do some preparatory work on the series before applying it to the git repository (e.g. a 3-way merge), you should consider using b4 shazam to apply the retrieved series. don't make extra work for yourself, bestie. π
for options and their descriptions, see b4 am --help.
Examples β¨
b4 am -sl [msgid]
download a thread from the default public-inbox server, apply any follow-up trailers, add your own Signed-Off-By trailer plus a Link: trailer indicating the origin of the patch, then save the resulting .mbox file in the current directory ready to be applied by "git am".
b4 am -sl -P 1-3 [msgid]
same as the previous example, but pick only patches 1,2,3 from the entire series. selective. we love that. π
b4 am -3 [msgid]
download the series and prepare the local git tree for a 3-way merge by ensuring that all index blobs exist.
b4 am --check [msgid]
download the series and show if it passes the checks. you can specify the command using the b4.am-perpatch-check-cmd configuration option. for the Linux kernel, the default will be the most common checkpatch.pl set of options.
β‘ b4 shazam
this is very similar to b4 am, but it also applies patches directly to the current git tree using git am. alternatively, when you use it with -H, it can fetch the patch series into FETCH_HEAD as if it were a pull request β ready to review and merge. b4 uses the cover letter as a template for the merge commit. yes ma'am. π
if you want to automatically invoke git-merge, use -M instead of -H. b4 automatically opens up the editor so you can edit the merge commit message. main character energy, honestly.
Note: the-Mand-Hoptions work best for series that have the base-commit info matching an object in your local tree.
for options and their descriptions, see b4 shazam --help.
Examples β¨
b4 shazam -sl -M [msgid]
download a thread from the default public-inbox server, apply any follow-up trailers, add your own Signed-Off-By trailer plus a Link: trailer with the origin of the patch, then merge this commit to the current git repository using the cover letter as the merge commit template.
b4 shazam -sl -M --merge-base v6.4-rc4 [msgid]
same as the previous example, but forces the merge-base to be the commit-ish object provided instead of the one listed in the patch series itself.
π b4 pr
this command is for working with pull requests submitted using git-request-pull. it gives you these benefits over just using git directly, and honestly they're kind of a big deal:
- it can check if the pull is already applied before performing a
git fetch - it checks the signature on the tag or tip commit specified in the pull request
- it can track applied pull requests and send replies to submitters using
b4 ty
for options and their descriptions, see b4 pr --help.
Examples β¨
b4 pr [msgid]
download the message with the pull-request and apply it to the current git tree.
π b4 ty
so if you've retrieved and applied some patches to your tree, you should be able to fire up the βauto-thankanatorβ πβ¨ which uses patch-id and commit subject tracking to figure out which series from the ones you retrieved you've already applied to your tree. the process is usually pretty fast and fairly accurate. it's giving gratitude automation.
if you want to send mails directly using -S, you should have a configured [sendemail] section somewhere in your applicable git configuration files. by default, b4 ty writes out .thanks files in the current directly that you can edit and sent out using a command like mutt -f thanks.file.
for options and their descriptions, see b4 ty --help.
Examples β¨
b4 ty -a -S
locate any retrieved series that you have applied to the current git repository and send out thanks to all members of the conversation. polite and efficient, we stan. π«Ά
b4 ty -a -S --dry-run
same as above, but instead of actually sending it out show what the message is going to be, first.
π b4 diff
the diff subcommand lets you compare two different revisions of the same patch series using git range-diff. okay but heads up: in order to perform the range-diff comparison, both revisions need to cleanly apply to the current tree, which may not always be possible to achieve. no cap.
for options and their descriptions, see b4 diff --help.
Examples β¨
b4 diff [msgid-of-vN]
retrieves the thread matching the msgid specified and attempts to auto-locate the previous version of the series. if successful, shows the output of git range-diff comparing the patch differences.
π b4 kr
this subcommand lets you maintain a local keyring of contributor keys. security bestie behavior. π
Note: this part of b4 is under active development with improvements planned for the near future. so like, it's growing. π±
for options and their descriptions, see b4 kr --help.
Examples β¨
b4 kr --show-keys [msgid]
retrieve the thread specified and show any cryptographic keys used to attest the patches.
π b4 prep, trailers, send
these commands let you prepare and submit a patch series for review on the mailing list. full documentation is available online at the following address:
<https://b4.docs.kernel.org/en/latest/contributor/overview.html>
for options, see the output of b4 prep --help, b4 trailers --help and b4 send --help.
Examples β¨
b4 prep -n my-new-feature -f v6.4-rc4
start a new branch, forking it from the tag v6.4-rc4, and prepare it for adding more patches.
b4 prep --edit-cover
edit the cover letter for the current series. this step isn't required for most single-patch submissions. (iykyk)
b4 prep --auto-to-cc
find all addresses that need to receive a copy of the patch series submission and add them to the cover letter.
b4 prep --check
run the configured checks on your series to identify any potential problems. for Linux kernel, this runs checkpatch.pl with the recommended set of parameters.
b4 send -o /tmp/outdir
generate the patches that b4 is going to send out and save them into the directory specified. this allows you to review the series before actually sending them.
b4 send --preview-to [addr1@example.com addr2@example.com]
send a "preview" version of the series for someone to check before submitting it upstream.
b4 trailers -u
retrieve any code-review trailers provided for your series and apply them to the current branch.
βοΈ CONFIGURATION βοΈ
b4 configuration is handled via git-config(1), so you can store it in either the toplevel $HOME/.gitconfig file, or in a per-repository .git/config file if your workflow changes per project. flexible. we love options. β¨
to see configuration options available, see online documentation at <https://b4.docs.kernel.org/en/latest/config.html>
π PROXYING REQUESTS π
commands making remote HTTP requests may be configured to use a proxy by setting the HTTPS_PROXY environment variable, as described in <https://docs.python-requests.org/en/latest/user/advanced/#proxies> . sneak through the side door, bestie. π§
π«Ά SUPPORT π«Ά
please email <tools@kernel.org> with support requests, or browse the list archive at <https://lore.kernel.org/tools> . someone will help you, fr fr.
βοΈ AUTHOR βοΈ
mricon@kernel.org
License: GPLv2+
π COPYRIGHT π
The Linux Foundation and contributors
okay that's the whole page, you're officially caught up π
and just so you have the receipts: this was version 0.14.3, dated 2025-10-01, from the section 5 file formats manual β so go forth and b4 shazam something, bestie. mwah. ππΈβ¨
π¦ where this page comes from
- epel 10: b4 0.14.3-2.el10_3 Β· GPL-2.0-or-later
- fedora 43: b4 0.14.3-2.fc43 Β· GPL-2.0-or-later
- fedora 44: b4 0.14.3-2.fc44 Β· GPL-2.0-or-later
- ubuntu resolute: b4 0.14.3-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms