git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Feature: git stash pop --always-drop

From
Jeff King <peff@peff.net>
Date
Aug 10, 2015, 13:49 UTC
Message-ID
<20150810134957.GC6763@sigill.intra.peff.net>
In-Reply-To
<loom.20150810T153939-856@post.gmane.org>
On Mon, Aug 10, 2015 at 01:43:07PM +0000, Ed Avis wrote:
Show 12 quoted lines
> Jeff King <peff <at> peff.net> writes:
> 
> >>An alternative would be for git stash to always print the name of the stash
> >>it is applying.
> 
> >  Applying refs/stash@{0} (31cb86c3d700d241e315d989f460e3e83f84fa19)
> 
> Yes, that's the one.
> 
> >Or maybe it would be useful to actually show the stash subject,
> 
> That could be nice to see, but is not a substitute for the SHA.

I think you'd be _technically_ OK without the sha1 in the "applying message", because you can refer to it as stash@{0} until it is dropped, and the drop message does mention the sha1. But that seems needlessly complicated for the user. I agree that including the sha1 is reasonable (though we might want to use an abbreviated one if there is other stuff to go on the line).

> If the stash pop failed because of conflicts then it could even print
> 
>     To drop this stash manually, run 'git stash drop abcde...'

Yup, that makes sense. You might want to make it optional an advice.* config key, though. I also wondered if the "dropped" message is sufficiently clear to new users. The point of it, I think, is to allow a final "oops, I didn't mean to do that" moment. But there are no instructions for how one would re-create the same stash.

It might be that showing instructions on even successful drops would quickly get annoying, though. I dunno. I tend to turn off most of our advice config myself.

> Another feature I would like to see is a kind of atomic stash apply, where
> either the whole change can be applied to the working tree without conflicts,
> or nothing happens.

I think that may be a bit harder, as the merge machinery would have to know how to be atomic. Still, I agree it's a good goal if you'd like to work on it.

-Peff
Previous: Ed AvisNext: Ed Avis
Message 6 of 9 in “Feature: git stash pop --always-drop”
  1. Ed AvisAug 10, 2015
  2. Jeff KingAug 10, 2015
  3. Ed AvisAug 10, 2015
  4. Jeff KingAug 10, 2015
  5. Ed AvisAug 10, 2015
  6. Jeff KingAug 10, 2015
  7. Ed AvisAug 10, 2015
  8. Junio C HamanoAug 10, 2015
  9. Ed AvisAug 10, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.