Subject: Re: [FEATURE] Proposal: git stash --only-unstaged

From: Phillip Wood <[email-masked]>
Date: Tue, 16 Sep 2025 12:03:11 +0100

Hi Ben

On 29/08/2025 14:30, D. Ben Knoble wrote:
> On Fri, Aug 29, 2025 at 9:06 AM Phillip Wood <[email-masked]> wrote:
>>
>> I think the example works but may generate conflicts when the stash is
>> popped. One can argue that the conflicts are unnecessary because they
>> could be avoided by popping the unstaged changes but I don't think the
>> example is broken as such.
> 
> Thanks, let me try to rephrase: the example makes no mention of
> conflicts appearing or having to adjust them. It seems to heavily
> imply to me that no such conflicts are expected, though as we
> discussed upthread it seems unlikely you _won't_ get conflicts if you
> do

Yes, I think if you edit any staged changes (that is the lines that 
differed between the index and HEAD when "git stash" was run) you'll end 
up with conflicts. If you edit a line where the index, HEAD and the 
worktree matched when the stash was created then I don't think you will 
see a conflict. Overall conflicts seem pretty likely, so maybe we should 
mention them in the documentation.

> [...]
> I suppose my main complaint is nothing about the example makes it
> clear that's the intended use case to me? Hence
> - we could change the example to mention conflicts and/or use case
> (smaller patch, punts on the problem)
> - we could change the code to accommodate the example as written
> (using ideas from your script; harder but bigger win IMO?)

I was hoping that we'd hear back from J. Dettweiler as to whether the 
ideas in the script were useful. It would certainly be better to update 
the command to avoid conflicts if we can.

Thanks

Phillip