Re: [FEATURE] Proposal: git stash --only-unstaged
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Sep 16, 2025, 11:03 UTC
- Message-ID
- <4b689f92-5277-4e57-b4b7-8cc241ddd664@gmail.com>
- In-Reply-To
- <CALnO6CCsFuYqo-q8D1g=vR9q22+Cy1MAgk1Ld0cD1wFNjr-eSw@mail.gmail.com>
Hi Ben
On 29/08/2025 14:30, D. Ben Knoble wrote:
Show 12 quoted lines
> On Fri, Aug 29, 2025 at 9:06 AM Phillip Wood <phillip.wood123@gmail.com> 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.
Show 7 quoted lines
> [...] > 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