Re: Can we do better than "git checkout/add -p"

Christian Couder <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <CAP8UFD0i3fr8sNu6wa8iqfdy3t=j0aVHVpjsvks43WVKogSdXg@mail.gmail.com>
On Fri, Aug 7, 2026 at 6:02 AM Junio C Hamano <[email protected]> wrote:
>
> I am doing more "git checkout -p" (selective revert of local changes
> out of the working tree files) these days, as well as "git add -p"
> (selective adding of local changes to the index), and what I often
> wish is to have _both_ as possible options in a single session.
> That is, the local changes in my working tree often fall into three
> categories.  (1) One that is clearly good, (2) one that is good but
> not yet ready, and (3) one that is bogus and should be discarded.

What if there is a hunk you want to squash to a previous commit like
HEAD~2 or to a new commit in a separate branch?

I think that if we add a new way to handle hunks, we should consider
more cases than just reverting, keeping or indexing. We could perhaps
take advantage of recent developments in `git history` to implement
the additional cases.

On the other hand, it seems to me that GitButler's `but rub` command
could do a lot of things like that, but it looks like they recently
replaced and split that command into more explicit, intent-based
commands (see https://github.com/gitbutlerapp/gitbutler/releases).

So I guess the main issue in designing such a feature is to make it do
many things, but not too many.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.