From: Patrick Steinhardt <ps@pks.im>
To: "D. Ben Knoble" <ben.knoble@gmail.com>
Cc: git@vger.kernel.org, Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH 8/8] builtin/history: implement "split" subcommand
Date: Wed, 11 Mar 2026 10:26:20 +0100 [thread overview]
Message-ID: <abE1PPWRdPaHMaAs@pks.im> (raw)
In-Reply-To: <CALnO6CC_UMnQvcyCe37mCan8eASugknK-WbVp-KWXWptvrsJDg@mail.gmail.com>
On Tue, Mar 03, 2026 at 01:47:27PM -0500, D. Ben Knoble wrote:
> On Mon, Mar 2, 2026 at 7:13 AM Patrick Steinhardt <ps@pks.im> wrote:
> > diff --git a/Documentation/git-history.adoc b/Documentation/git-history.adoc
> > index cc019de697..24dc907033 100644
> > --- a/Documentation/git-history.adoc
> > +++ b/Documentation/git-history.adoc
> > @@ -57,6 +58,26 @@ The following commands are available to rewrite history in different ways:
> > details of this commit remain unchanged. This command will spawn an
> > editor with the current message of that commit.
> >
> > +`split <commit> [--] [<pathspec>...]`::
> > + Interactively split up <commit> into two commits by choosing
> > + hunks introduced by it that will be moved into the new split-out
> > + commit. These hunks will then be written into a new commit that
> > + becomes the parent of the previous commit. The original commit
> > + stays intact, except that its parent will be the newly split-out
> > + commit.
> > ++
> > +The commit messages of the split-up commits will be asked for by launching
> > +the configured editor. Authorship of the commit will be the same as for the
> > +original commit.
> > ++
> > +If passed, _<pathspec>_ can be used to limit which changes shall be split out
> > +of the original commit. Files not matching any of the pathspecs will remain
> > +part of the original commit. For more details, see the 'pathspec' entry in
> > +linkgit:gitglossary[7].
>
> That is quite convenient when changes to 2 independent areas have
> become mixed. Nice.
>
> > +It is invalid to select either all or no hunks, as that would lead to
> > +one of the commits becoming empty.
>
> Is it easy to make this a no-op? It could be done later if that
> suggestion is contentions. But I figure rather than error we can
> silently do nothing, since we have performed the desired split. (Or
> even use this to split an "--allow-empty" commit, but… why that's
> desirable, I can't guess.)
>
> So yeah, probably for later.
I mean we could make it a no-op, but wouldn't that make the interface
even more confusing? You don't really split a commit in the case where
you select everything or nothing, as you'd only end up with a single
commit in that case. Making one of the commits completely empty would
probably be an accident in almost all cases, I would claim.
But yeah, if there actually are use cases for this I would say that we
could then introduce "--allow-empty" for this command at a later point.
Patrick
next prev parent reply other threads:[~2026-03-11 9:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 12:13 [PATCH 0/8] history: introduce "split" subcommand Patrick Steinhardt
2026-03-02 12:13 ` [PATCH 1/8] add-patch: split out header from "add-interactive.h" Patrick Steinhardt
2026-03-02 12:13 ` [PATCH 2/8] add-patch: split out `struct interactive_options` Patrick Steinhardt
2026-03-02 12:13 ` [PATCH 3/8] add-patch: remove dependency on "add-interactive" subsystem Patrick Steinhardt
2026-03-02 12:13 ` [PATCH 4/8] add-patch: add support for in-memory index patching Patrick Steinhardt
2026-03-02 12:13 ` [PATCH 5/8] add-patch: allow disabling editing of hunks Patrick Steinhardt
2026-03-02 12:13 ` [PATCH 6/8] cache-tree: allow writing in-memory index as tree Patrick Steinhardt
2026-03-02 12:13 ` [PATCH 7/8] builtin/history: split out extended function to create commits Patrick Steinhardt
2026-03-03 18:43 ` D. Ben Knoble
2026-03-11 9:26 ` Patrick Steinhardt
2026-03-02 12:13 ` [PATCH 8/8] builtin/history: implement "split" subcommand Patrick Steinhardt
2026-03-03 18:47 ` D. Ben Knoble
2026-03-11 9:26 ` Patrick Steinhardt [this message]
2026-03-03 18:41 ` [PATCH 0/8] history: introduce " D. Ben Knoble
2026-03-13 22:35 ` Junio C Hamano
2026-03-16 7:13 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=abE1PPWRdPaHMaAs@pks.im \
--to=ps@pks.im \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox