Volume XXII, number 280Wednesday, October 7, 2026Latest message 2 hours ago

The Git List

News and archive of git@vger.kernel.org, since April 2005

[RFC] git am: apply patches directly via message id

5 messages between Mar 19, 2026 and Mar 19, 2026, from Shreyansh Paliwal, Junio C Hamano.

Plain Markdown or JSON for tools and agents.

Shreyansh PaliwalMar 19, 2026, 09:23 UTC on lore
Hi,

Currently, git am supports applying patches through several methods, mbox files, .patch files, maildir directories etc. However, all of these require the user to first obtain the patch file locally before applying it. I was thinking that it would be a lot more convinient to directly apply patches by by their message id of emails, without any manual downloading by the help of a new option '--fetch-mid'. It would something be like,

        git am --fetch-mid "foo1@bar" "foo2@bar"
We can fetch the patch/es from the standard url format like,
        `https://lore.kernel.org/git/<message-id>/raw`

We can also make the base URL configurable via a new config key am.publicInboxUrl, defaulting to https://lore.kernel.org, so that users on private setups can point it at their own public-inbox instance. The fetched content is already in mbox format, so the patch application logic won't need any change. A further addition to this can be to just provide the message id of the cover letter of patch and automatically it would fetch all the patches.

Does this sound like a useful feature to add or maybe any kind of indirect implementation is already there and I am missing anything. Let me know what are your thoughts on this.

Best, Shreyansh

Junio C HamanoMar 19, 2026, 13:43 UTC in reply to Shreyansh Paliwal on lore

Re: [RFC] git am: apply patches directly via message id

Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com> writes:
> Does this sound like a useful feature to add or maybe any kind of indirect
> implementation is already there and I am missing anything. Let me know what
> are your thoughts on this.
Sounds a lot like "b4 am -o-" piped to "git am" to me.
Shreyansh PaliwalMar 19, 2026, 15:21 UTC in reply to Junio C Hamano on lore

Re: [RFC] git am: apply patches directly via message id

Show 8 quoted lines
> Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com> writes:
>
> > Does this sound like a useful feature to add or maybe any kind of indirect
> > implementation is already there and I am missing anything. Let me know what
> > are your thoughts on this.
>
> Sounds a lot like "b4 am -o-" piped to "git am" to me.
>

I see. Though I think b4 is an external library, and I am reckoning that this functionality is used commonly so would it make sense to add this natively in git am ? or it is fine using b4 for this.

Junio C HamanoMar 19, 2026, 15:35 UTC in reply to Shreyansh Paliwal on lore

Re: [RFC] git am: apply patches directly via message id

Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com> writes:
Show 5 quoted lines
>> Sounds a lot like "b4 am -o-" piped to "git am" to me.
>
> I see. Though I think b4 is an external library, and I am reckoning that
> this functionality is used commonly so would it make sense to add this
> natively in git am ? or it is fine using b4 for this.

But lore (and the way it takes the message-ID and returns not just a single message but a mbox with all patches in a complete series) is very specific external dependency. It does not belong to "git am", whose only purpose is to accept a mailbox with bunch of patches (and we do not care how you downloaded the mailbox) and create commits out of them. Interacting with lore and downloading patches from it is what "b4" does and it does it well.

So, no, it is not _fine_ using b4 for this. It is crazy not to use it for this.

Shreyansh PaliwalMar 19, 2026, 15:45 UTC in reply to Junio C Hamano on lore

Re: [RFC] git am: apply patches directly via message id

Show 15 quoted lines
> Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com> writes:
>
> >> Sounds a lot like "b4 am -o-" piped to "git am" to me.
> >
> > I see. Though I think b4 is an external library, and I am reckoning that
> > this functionality is used commonly so would it make sense to add this
> > natively in git am ? or it is fine using b4 for this.
>
> But lore (and the way it takes the message-ID and returns not just a
> single message but a mbox with all patches in a complete series) is
> very specific external dependency.  It does not belong to "git am",
> whose only purpose is to accept a mailbox with bunch of patches (and
> we do not care how you downloaded the mailbox) and create commits
> out of them.  Interacting with lore and downloading patches from it
> is what "b4" does and it does it well.
Hmm. That makes sense. Thanks.

Back to recent threads