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

Re: Usability of git stash

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 20, 2008, 05:29 UTC
Message-ID
<7vmygz4yws.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20081020003644.GA10412@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 11 quoted lines
>   git checkout next ;# which is where I usually am anyway
>   hack hack hack
>   # oops, I have been building this directly on top of next and it
>   # really needs to be a feature-branch on maint
>   git stash
>   git checkout -b jk/maint-fix-whatever origin/maint
>   git stash apply
>
> The equivalent non-stash commands would be "commit -m wip" and
> "cherry-pick". But the stash saves me the trouble later of having to
> delete the wip cruft on top of next.
The equivalent would be:
	git checkout -m -b jk/maint-fix-whatever origin/maint
no need for stash, wip-commit, nor cherry-pick.

The advantage of using "stash then stash apply" (not "stash pop") or "wip-commit with cherry-pick" is that you can reset, take a deep breath, and redo it, when the resulting merge conflict gets too hairy.

> I disagree. I think the strength of stash is that it is divorced from
> the history. So it is more like a cherry-pick (or diff | apply, which is
> what it was intended to replace).
I agree with you; it really is the "diff saved somewhere, later applied".
Previous: Jeff KingNext: Miles Bader
Message 12 of 15 in “Usability of git stash”
  1. Anders MelchiorsenOct 15, 2008
  2. Brandon CaseyOct 15, 2008
  3. David KastrupOct 16, 2008
  4. Brandon CaseyOct 16, 2008
  5. Anders MelchiorsenOct 18, 2008
  6. Shawn O. PearceOct 19, 2008
  7. Leo RazoumovOct 19, 2008
  8. Shawn O. PearceOct 19, 2008
  9. Stephan BeyerOct 19, 2008
  10. Miles BaderOct 20, 2008
  11. Jeff KingOct 20, 2008
  12. Junio C HamanoOct 20, 2008
  13. Miles BaderOct 20, 2008
  14. Andreas EricssonOct 20, 2008
  15. Brandon CaseyOct 20, 2008

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.