public inbox for tools@linux.kernel.org
 help / color / mirror / Atom feed
* Using "b4 prep" with Stacked Git
@ 2026-03-17 15:01 Chuck Lever
  2026-03-17 15:26 ` Paul Moore
  0 siblings, 1 reply; 10+ messages in thread
From: Chuck Lever @ 2026-03-17 15:01 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: users, tools

Hi Konstantin -

I'm a long-time Stacked Git and b4 user and I'm hunting for a tool to
juggle the many data items involved with posting kernel patch series
for review. "b4 prep" seems to fit that bill but it has some issues
when it comes to large cover letters with Stacked Git.

The branch-description strategy is the least-bad option for StGit
right now, but it's fighting git's design -- git config was never
meant to hold multi-paragraph prose, and there's no way to tell StGit
"don't print the branch description in stg branch --list."

A file-based strategy would solve all three problems cleanly. Something like:

.git/b4-cover/<branchname>/subject
.git/b4-cover/<branchname>/body
.git/b4-cover/<branchname>/changelog
.git/b4-cover/<branchname>/recipients

Or b4 could use a single file with delimiters or structured with JSON.

Advantages over the existing branch-description strategy:
- Each piece is a plain text file, editable with $EDITOR directly
- stg branch --list output stays clean
- Changelog and recipients are structurally separated from the cover
body, so --auto-to-cc can write to recipients without risking
corruption of the larger prose items
- Trivial to version-control the cover letters separately if desired

The tracking metadata (change-id, revision, base-branch) could stay in
b4-tracking in git config -- that data is small and
machine-manageable. The cover-strategy mechanism already exists, so
adding a new file or work-tree-file strategy would slot in naturally.

I'm asking before prototyping to see if you've already considered this
idea, might have another idea, or might have something already in the
works.

-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using "b4 prep" with Stacked Git
  2026-03-17 15:01 Using "b4 prep" with Stacked Git Chuck Lever
@ 2026-03-17 15:26 ` Paul Moore
  2026-03-17 15:48   ` Chuck Lever
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Paul Moore @ 2026-03-17 15:26 UTC (permalink / raw)
  To: Chuck Lever; +Cc: Konstantin Ryabitsev, users, tools

On Tue, Mar 17, 2026 at 11:08 AM Chuck Lever <chucklever@gmail.com> wrote:
>
> Hi Konstantin -
>
> I'm a long-time Stacked Git and b4 user and I'm hunting for a tool to
> juggle the many data items involved with posting kernel patch series
> for review. "b4 prep" seems to fit that bill but it has some issues
> when it comes to large cover letters with Stacked Git.
>
> The branch-description strategy is the least-bad option for StGit
> right now, but it's fighting git's design -- git config was never
> meant to hold multi-paragraph prose, and there's no way to tell StGit
> "don't print the branch description in stg branch --list."
>
> A file-based strategy would solve all three problems cleanly. Something like:
>
> .git/b4-cover/<branchname>/subject
> .git/b4-cover/<branchname>/body
> .git/b4-cover/<branchname>/changelog
> .git/b4-cover/<branchname>/recipients

Fellow stacked git fan here.

I do something very similar with my own scripts/tools, and if I could
offer a suggestion based on my experience, you might want to consider
some slight naming tweaks to support multiple cover letters in a
single branch.  It's common for me to use a single branch for multiple
revisions of a patchset and being able to refer to previous cover
letters without having to go to my email or lore is very handy.

This becomes easier if you include the To/CC, subject, body, and
diffstat all in one file.  My cover letter tool formats and keeps the
cover letter in a format that can be quickly copy-n-paste'd into my
editor during 'stg email send --compose'.

> I'm asking before prototyping to see if you've already considered this
> idea, might have another idea, or might have something already in the
> works.

I've built up a collection of shell scripts/tools built on top of
stacked git over the years to match my preferred workflow, but I
wouldn't consider them very pretty or something I would want to
support.  However, I'm happy to share the basics ideas/concepts that
I've found helpful :)

--
paul-moore.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using "b4 prep" with Stacked Git
  2026-03-17 15:26 ` Paul Moore
@ 2026-03-17 15:48   ` Chuck Lever
  2026-03-17 18:57     ` Paul Moore
  2026-03-17 15:54   ` Miquel Raynal
  2026-03-17 16:51   ` Toke Høiland-Jørgensen
  2 siblings, 1 reply; 10+ messages in thread
From: Chuck Lever @ 2026-03-17 15:48 UTC (permalink / raw)
  To: Paul Moore; +Cc: Konstantin Ryabitsev, users, tools

On Tue, Mar 17, 2026 at 11:27 AM Paul Moore <paul@paul-moore.com> wrote:
>
> On Tue, Mar 17, 2026 at 11:08 AM Chuck Lever <chucklever@gmail.com> wrote:
> >
> > Hi Konstantin -
> >
> > I'm a long-time Stacked Git and b4 user and I'm hunting for a tool to
> > juggle the many data items involved with posting kernel patch series
> > for review. "b4 prep" seems to fit that bill but it has some issues
> > when it comes to large cover letters with Stacked Git.
> >
> > The branch-description strategy is the least-bad option for StGit
> > right now, but it's fighting git's design -- git config was never
> > meant to hold multi-paragraph prose, and there's no way to tell StGit
> > "don't print the branch description in stg branch --list."
> >
> > A file-based strategy would solve all three problems cleanly. Something like:
> >
> > .git/b4-cover/<branchname>/subject
> > .git/b4-cover/<branchname>/body
> > .git/b4-cover/<branchname>/changelog
> > .git/b4-cover/<branchname>/recipients
>
> Fellow stacked git fan here.
>
> I do something very similar with my own scripts/tools, and if I could
> offer a suggestion based on my experience, you might want to consider
> some slight naming tweaks to support multiple cover letters in a
> single branch.  It's common for me to use a single branch for multiple
> revisions of a patchset and being able to refer to previous cover
> letters without having to go to my email or lore is very handy.

I also sometimes use multiple cover letters per branch, but I just
considered that a bad personal habit ;-)


> This becomes easier if you include the To/CC, subject, body, and
> diffstat all in one file.  My cover letter tool formats and keeps the
> cover letter in a format that can be quickly copy-n-paste'd into my
> editor during 'stg email send --compose'.

I've been doing that by hand until now, in a single file. But that
requires tracking series version, In-reply-to, and other things that
"b4 prep" brings to the table automatically.

Sounds like one vote for "single unstructured file rather than
separate files". Would you send me your tool privately?


> > I'm asking before prototyping to see if you've already considered this
> > idea, might have another idea, or might have something already in the
> > works.
>
> I've built up a collection of shell scripts/tools built on top of
> stacked git over the years to match my preferred workflow, but I
> wouldn't consider them very pretty or something I would want to
> support.  However, I'm happy to share the basics ideas/concepts that
> I've found helpful :)

A bit off topic: I've been building a Claude skill for using Stacked
Git that encapsulates some of my habits and prevents Claude from
having to rediscover how to translate its git commands to Stacked Git
commands. It's here:

   https://github.com/chucklever/cel-kdev/blob/master/plugin/cel-kdev/skills/stg/SKILL.md

I'd very much like to learn how others are using "stg" to incorporate
those ideas into the skill. Or, if someone knows of something
better...

-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using "b4 prep" with Stacked Git
  2026-03-17 15:26 ` Paul Moore
  2026-03-17 15:48   ` Chuck Lever
@ 2026-03-17 15:54   ` Miquel Raynal
  2026-03-17 16:51   ` Toke Høiland-Jørgensen
  2 siblings, 0 replies; 10+ messages in thread
From: Miquel Raynal @ 2026-03-17 15:54 UTC (permalink / raw)
  To: Paul Moore; +Cc: Chuck Lever, Konstantin Ryabitsev, users, tools

Hello,

>> A file-based strategy would solve all three problems cleanly. Something like:
>>
>> .git/b4-cover/<branchname>/subject
>> .git/b4-cover/<branchname>/body
>> .git/b4-cover/<branchname>/changelog
>> .git/b4-cover/<branchname>/recipients
>
> Fellow stacked git fan here.
>
> I do something very similar with my own scripts/tools, and if I could
> offer a suggestion based on my experience, you might want to consider
> some slight naming tweaks to support multiple cover letters in a
> single branch.

I've transitioned to b4 a few months ago, I really like the tool, but if
there is one key feature it lacks based on my very own workflow, it is
indeed the capability to stack series. I often have to manage several
series which depend on each other. b4 in this case requires one branch
per series which is painful to maintain.

A big +1 to whoever will propose such a stacked Git capability :-)

Cheers,
Miquèl

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using "b4 prep" with Stacked Git
  2026-03-17 15:26 ` Paul Moore
  2026-03-17 15:48   ` Chuck Lever
  2026-03-17 15:54   ` Miquel Raynal
@ 2026-03-17 16:51   ` Toke Høiland-Jørgensen
  2026-03-17 17:45     ` Chuck Lever
  2026-03-20 16:25     ` Konstantin Ryabitsev
  2 siblings, 2 replies; 10+ messages in thread
From: Toke Høiland-Jørgensen @ 2026-03-17 16:51 UTC (permalink / raw)
  To: Paul Moore, Chuck Lever; +Cc: Konstantin Ryabitsev, users, tools

Paul Moore <paul@paul-moore.com> writes:

> On Tue, Mar 17, 2026 at 11:08 AM Chuck Lever <chucklever@gmail.com> wrote:
>>
>> Hi Konstantin -
>>
>> I'm a long-time Stacked Git and b4 user and I'm hunting for a tool to
>> juggle the many data items involved with posting kernel patch series
>> for review. "b4 prep" seems to fit that bill but it has some issues
>> when it comes to large cover letters with Stacked Git.
>>
>> The branch-description strategy is the least-bad option for StGit
>> right now, but it's fighting git's design -- git config was never
>> meant to hold multi-paragraph prose, and there's no way to tell StGit
>> "don't print the branch description in stg branch --list."
>>
>> A file-based strategy would solve all three problems cleanly. Something like:
>>
>> .git/b4-cover/<branchname>/subject
>> .git/b4-cover/<branchname>/body
>> .git/b4-cover/<branchname>/changelog
>> .git/b4-cover/<branchname>/recipients
>
> Fellow stacked git fan here.

And here! I have been using the "cover letter as commit" mode of b4,
which works as long as you remember to 'stg commit --all' before you
invoke b4. I requested a pre-hook functionality in b4 to automate this,
so will take this opportunity to bump that:

https://lore.kernel.org/tools/87ttdkrylx.fsf@toke.dk/

-Toke

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using "b4 prep" with Stacked Git
  2026-03-17 16:51   ` Toke Høiland-Jørgensen
@ 2026-03-17 17:45     ` Chuck Lever
  2026-03-18 14:44       ` Toke Høiland-Jørgensen
  2026-03-20 16:25     ` Konstantin Ryabitsev
  1 sibling, 1 reply; 10+ messages in thread
From: Chuck Lever @ 2026-03-17 17:45 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen
  Cc: Paul Moore, Konstantin Ryabitsev, users, tools

On Tue, Mar 17, 2026 at 12:51 PM Toke Høiland-Jørgensen <toke@toke.dk> wrote:
>
> Paul Moore <paul@paul-moore.com> writes:
>
> > On Tue, Mar 17, 2026 at 11:08 AM Chuck Lever <chucklever@gmail.com> wrote:
> >>
> >> Hi Konstantin -
> >>
> >> I'm a long-time Stacked Git and b4 user and I'm hunting for a tool to
> >> juggle the many data items involved with posting kernel patch series
> >> for review. "b4 prep" seems to fit that bill but it has some issues
> >> when it comes to large cover letters with Stacked Git.
> >>
> >> The branch-description strategy is the least-bad option for StGit
> >> right now, but it's fighting git's design -- git config was never
> >> meant to hold multi-paragraph prose, and there's no way to tell StGit
> >> "don't print the branch description in stg branch --list."
> >>
> >> A file-based strategy would solve all three problems cleanly. Something like:
> >>
> >> .git/b4-cover/<branchname>/subject
> >> .git/b4-cover/<branchname>/body
> >> .git/b4-cover/<branchname>/changelog
> >> .git/b4-cover/<branchname>/recipients
> >
> > Fellow stacked git fan here.
>
> And here! I have been using the "cover letter as commit" mode of b4,
> which works as long as you remember to 'stg commit --all' before you
> invoke b4. I requested a pre-hook functionality in b4 to automate this,
> so will take this opportunity to bump that:
>
> https://lore.kernel.org/tools/87ttdkrylx.fsf@toke.dk/

To quote your 2024 email:
> So, my feature request is this: add support to b4 for a hook command
> that is executed before any operation that will rewrite history - and
> abort the rewriting if the command fails.

Ha! I set up a hook in my stg skill to interrupt Claude before it
tries to modify the series using raw git commands. Same hazard.

I looked at using the commit strategy and felt it doesn't work well
with my own stg muscle memory. I didn't think of using a hook.


-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using "b4 prep" with Stacked Git
  2026-03-17 15:48   ` Chuck Lever
@ 2026-03-17 18:57     ` Paul Moore
  0 siblings, 0 replies; 10+ messages in thread
From: Paul Moore @ 2026-03-17 18:57 UTC (permalink / raw)
  To: Chuck Lever; +Cc: Konstantin Ryabitsev, users, tools

On Tue, Mar 17, 2026 at 11:48 AM Chuck Lever <chucklever@gmail.com> wrote:
> On Tue, Mar 17, 2026 at 11:27 AM Paul Moore <paul@paul-moore.com> wrote:
> > On Tue, Mar 17, 2026 at 11:08 AM Chuck Lever <chucklever@gmail.com> wrote:
> > >
> > > Hi Konstantin -
> > >
> > > I'm a long-time Stacked Git and b4 user and I'm hunting for a tool to
> > > juggle the many data items involved with posting kernel patch series
> > > for review. "b4 prep" seems to fit that bill but it has some issues
> > > when it comes to large cover letters with Stacked Git.
> > >
> > > The branch-description strategy is the least-bad option for StGit
> > > right now, but it's fighting git's design -- git config was never
> > > meant to hold multi-paragraph prose, and there's no way to tell StGit
> > > "don't print the branch description in stg branch --list."
> > >
> > > A file-based strategy would solve all three problems cleanly. Something like:
> > >
> > > .git/b4-cover/<branchname>/subject
> > > .git/b4-cover/<branchname>/body
> > > .git/b4-cover/<branchname>/changelog
> > > .git/b4-cover/<branchname>/recipients
> >
> > Fellow stacked git fan here.
> >
> > I do something very similar with my own scripts/tools, and if I could
> > offer a suggestion based on my experience, you might want to consider
> > some slight naming tweaks to support multiple cover letters in a
> > single branch.  It's common for me to use a single branch for multiple
> > revisions of a patchset and being able to refer to previous cover
> > letters without having to go to my email or lore is very handy.
>
> I also sometimes use multiple cover letters per branch, but I just
> considered that a bad personal habit ;-)

Heh, I guess "bad personal habit" could describe most of my workflow ;)

> > This becomes easier if you include the To/CC, subject, body, and
> > diffstat all in one file.  My cover letter tool formats and keeps the
> > cover letter in a format that can be quickly copy-n-paste'd into my
> > editor during 'stg email send --compose'.
>
> I've been doing that by hand until now, in a single file. But that
> requires tracking series version, In-reply-to, and other things that
> "b4 prep" brings to the table automatically.
>
> Sounds like one vote for "single unstructured file rather than
> separate files". Would you send me your tool privately?

Be careful what you wish for ... ;)

There isn't anything private or scanadlous in there, and on the off
chance that might serve as a use case example, or perhaps a warning to
others, I just tossed the script up in a GH repo:

https://github.com/pcmoore/pstg

The cover letter script is the 'pstg-cl', and you should probably be
able to get the basic idea of the tool without having to read the
other scripts.

https://github.com/pcmoore/pstg/blob/main/pstg-cl

> > > I'm asking before prototyping to see if you've already considered this
> > > idea, might have another idea, or might have something already in the
> > > works.
> >
> > I've built up a collection of shell scripts/tools built on top of
> > stacked git over the years to match my preferred workflow, but I
> > wouldn't consider them very pretty or something I would want to
> > support.  However, I'm happy to share the basics ideas/concepts that
> > I've found helpful :)
>
> A bit off topic: I've been building a Claude skill for using Stacked
> Git that encapsulates some of my habits and prevents Claude from
> having to rediscover how to translate its git commands to Stacked Git
> commands. It's here:
>
>    https://github.com/chucklever/cel-kdev/blob/master/plugin/cel-kdev/skills/stg/SKILL.md
>
> I'd very much like to learn how others are using "stg" to incorporate
> those ideas into the skill.

If you're really curious, the 'pstg-pwork' tool is essentially my
reviewer/maintainer workflow in script form.  It's ugly, but it works
for me :)

I do plan to add some LLM patch review options to my scripts, but I've
been a bit behind on things and haven't found the time yet.

-- 
paul-moore.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using "b4 prep" with Stacked Git
  2026-03-17 17:45     ` Chuck Lever
@ 2026-03-18 14:44       ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 10+ messages in thread
From: Toke Høiland-Jørgensen @ 2026-03-18 14:44 UTC (permalink / raw)
  To: Chuck Lever; +Cc: Paul Moore, Konstantin Ryabitsev, users, tools

Chuck Lever <chucklever@gmail.com> writes:

> On Tue, Mar 17, 2026 at 12:51 PM Toke Høiland-Jørgensen <toke@toke.dk> wrote:
>>
>> Paul Moore <paul@paul-moore.com> writes:
>>
>> > On Tue, Mar 17, 2026 at 11:08 AM Chuck Lever <chucklever@gmail.com> wrote:
>> >>
>> >> Hi Konstantin -
>> >>
>> >> I'm a long-time Stacked Git and b4 user and I'm hunting for a tool to
>> >> juggle the many data items involved with posting kernel patch series
>> >> for review. "b4 prep" seems to fit that bill but it has some issues
>> >> when it comes to large cover letters with Stacked Git.
>> >>
>> >> The branch-description strategy is the least-bad option for StGit
>> >> right now, but it's fighting git's design -- git config was never
>> >> meant to hold multi-paragraph prose, and there's no way to tell StGit
>> >> "don't print the branch description in stg branch --list."
>> >>
>> >> A file-based strategy would solve all three problems cleanly. Something like:
>> >>
>> >> .git/b4-cover/<branchname>/subject
>> >> .git/b4-cover/<branchname>/body
>> >> .git/b4-cover/<branchname>/changelog
>> >> .git/b4-cover/<branchname>/recipients
>> >
>> > Fellow stacked git fan here.
>>
>> And here! I have been using the "cover letter as commit" mode of b4,
>> which works as long as you remember to 'stg commit --all' before you
>> invoke b4. I requested a pre-hook functionality in b4 to automate this,
>> so will take this opportunity to bump that:
>>
>> https://lore.kernel.org/tools/87ttdkrylx.fsf@toke.dk/
>
> To quote your 2024 email:
>> So, my feature request is this: add support to b4 for a hook command
>> that is executed before any operation that will rewrite history - and
>> abort the rewriting if the command fails.
>
> Ha! I set up a hook in my stg skill to interrupt Claude before it
> tries to modify the series using raw git commands. Same hazard.
>
> I looked at using the commit strategy and felt it doesn't work well
> with my own stg muscle memory. I didn't think of using a hook.

So that's a +1 for the hook feature request, then? ;)

-Toke

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using "b4 prep" with Stacked Git
  2026-03-17 16:51   ` Toke Høiland-Jørgensen
  2026-03-17 17:45     ` Chuck Lever
@ 2026-03-20 16:25     ` Konstantin Ryabitsev
  2026-03-21 20:53       ` Toke Høiland-Jørgensen
  1 sibling, 1 reply; 10+ messages in thread
From: Konstantin Ryabitsev @ 2026-03-20 16:25 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: Paul Moore, Chuck Lever, users, tools

On Tue, Mar 17, 2026 at 05:51:18PM +0100, Toke Høiland-Jørgensen wrote:
> And here! I have been using the "cover letter as commit" mode of b4,
> which works as long as you remember to 'stg commit --all' before you
> invoke b4. I requested a pre-hook functionality in b4 to automate this,
> so will take this opportunity to bump that:

This is now in master, in case you missed the bugbot notice. Please let me
know if I can do something else to help, and thank you for your patience
waiting for it. :)

Regards,
-- 
KR

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using "b4 prep" with Stacked Git
  2026-03-20 16:25     ` Konstantin Ryabitsev
@ 2026-03-21 20:53       ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 10+ messages in thread
From: Toke Høiland-Jørgensen @ 2026-03-21 20:53 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: Paul Moore, Chuck Lever, users, tools

Konstantin Ryabitsev <mricon@kernel.org> writes:

> On Tue, Mar 17, 2026 at 05:51:18PM +0100, Toke Høiland-Jørgensen wrote:
>> And here! I have been using the "cover letter as commit" mode of b4,
>> which works as long as you remember to 'stg commit --all' before you
>> invoke b4. I requested a pre-hook functionality in b4 to automate this,
>> so will take this opportunity to bump that:
>
> This is now in master, in case you missed the bugbot notice. Please let me
> know if I can do something else to help, and thank you for your patience
> waiting for it. :)

Great, many thanks! Will take it for a spin :)

-Toke

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-03-21 20:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17 15:01 Using "b4 prep" with Stacked Git Chuck Lever
2026-03-17 15:26 ` Paul Moore
2026-03-17 15:48   ` Chuck Lever
2026-03-17 18:57     ` Paul Moore
2026-03-17 15:54   ` Miquel Raynal
2026-03-17 16:51   ` Toke Høiland-Jørgensen
2026-03-17 17:45     ` Chuck Lever
2026-03-18 14:44       ` Toke Høiland-Jørgensen
2026-03-20 16:25     ` Konstantin Ryabitsev
2026-03-21 20:53       ` Toke Høiland-Jørgensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox