From: Christian Couder Date: Fri, 07 Aug 2026 07:38:58 GMT Subject: Re: Can we do better than "git checkout/add -p" Message-ID: In-Reply-To: On Fri, Aug 7, 2026 at 6:02 AM Junio C Hamano 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.