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

Re: [PATCH 3/3] stash: require a clean index to apply

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 10, 2015, 19:16 UTC
Message-ID
<xmqq616vl6gm.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20150610185635.GA22800@peff.net>
Jeff King <peff@peff.net> writes:
Show 8 quoted lines
> So I am trying to figure out what the use case here is. Clearly the
> above is a toy case, but why is "stash -k" followed by a quick pop
> useful in general? Certainly I use "stash" (without "-k") and a quick
> pop all the time, and I think that is what stash was designed for.
>
> The best use case I can think of is Jonathan's original: to see only the
> staged content in the working tree, and then restore the original state.
> But stash does not currently work very well for that, as shown above.

The canonical use case for "stash -k" is to see only the content to be committed (for testing), commit it after testing and then pop on top of the committed result, which is the same as what you saw in the working tree and the index when you did "stash -k". I do not think "stash -k && stash pop" was in the design parameter when "-k" was added (as you demonstrated, it would not fundamentally work reliably depending on the differences between HEAD-Index-Worktree).

Previous: Jeff KingNext: Jeff King
Message 6 of 16 in “Re: [PATCH 3/3] stash: require a clean index to apply”
  1. Jonathan KamensJun 5, 2015
  2. Jeff KingJun 7, 2015
  3. Jeff KingJun 7, 2015
  4. bärJun 10, 2015
  5. Jeff KingJun 10, 2015
  6. Junio C HamanoJun 10, 2015
  7. Jeff KingJun 10, 2015
  8. bärJun 10, 2015
  9. Junio C HamanoJun 15, 2015
  10. Revert "stash: require a clean index to apply"Jeff King, Jun 15, 2015
  11. Junio C HamanoJun 15, 2015
  12. Jonathan KamensJun 25, 2015
  13. Jeff KingJun 26, 2015
  14. Jonathan KamensJun 26, 2015
  15. Jeff KingJun 26, 2015
  16. Junio C HamanoJun 26, 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.