Re: [FEATURE] Proposal: git stash --only-unstaged
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Sep 16, 2025, 17:10 UTC
- Message-ID
- <CALnO6CBprG+TSa3vtVjDOX5sF3MorvPv4Do7gA8mXXz26+3hUA@mail.gmail.com>
- In-Reply-To
- <4b689f92-5277-4e57-b4b7-8cc241ddd664@gmail.com>
On Tue, Sep 16, 2025 at 7:03 AM Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 23 quoted lines
> > Hi Ben > > On 29/08/2025 14:30, D. Ben Knoble wrote: > > 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.
Thanks—I realize we were talking across each other, so I'm glad we were able to get on the same page.
Show 11 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.
Sounds like a good idea.
-- D. Ben Knoble