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

Re: git-stash: RFC: Adopt the default behavior to other commands

From
Benoit Sigoure <tsuna@lrde.epita.fr>
Date
Dec 17, 2007, 22:32 UTC
Message-ID
<506C6191-655D-46AE-A5C2-1335A9044F44@lrde.epita.fr>
In-Reply-To
<20071217110322.GH14889@albany.tokkee.org>
On Dec 17, 2007, at 12:03 PM, Sebastian Harl wrote:
Show 16 quoted lines
> Hi,
>
> By default, git-stash (when called without any other arguments)  
> creates a new
> stash. This is quite different to the behavior of most other Git  
> commands
> (e.g. git-tag, git-branch, etc. do "list" by default). In order to  
> improve
> consistency git-stash should imho adopt this as well.
>
> The creation of a new stash should not do any harm. However, I  
> think that
> consistency is more important (iirc this has been mentioned in the  
> current
> survey a couple of times) and doing "list" is (in general) the best  
> default.
Hi Sebastian,
this topic has been brought up the ML several times already, and  
there seems to be some sort of consensus on the misbehavior of git  
stash and what the default should be (listing the stashes seems like  
a decent default action).  The current behavior of git stash is very  
dangerous as the following frequently happens to new comers:
   $ git stash
   $ <hack on something else>
   $ git commit
   $ git stash apply
   $ git stash clean # Oops, typo, I just stashed my changes again
   $ git stash clear # Oops, I just lost my changed

Hopefully, Git gives you means to recover from this sort of error, but most of the time new comers don't know them and just assume they lost their work.

Whenever I use git stash, it gives me chills, because I know I can easily screw things up (even though now I know how to recover from this sort of "user error").

Cheers,
-- 
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory
Previous: Sebastian HarlNext: Junio C Hamano
Message 2 of 33 in “git-stash: RFC: Adopt the default behavior to other commands”
  1. Sebastian HarlDec 17, 2007
  2. Benoit SigoureDec 17, 2007
  3. Junio C HamanoDec 17, 2007
  4. Benoit SigoureDec 17, 2007
  5. Junio C HamanoDec 18, 2007
  6. Sebastian HarlDec 18, 2007
  7. Johannes SchindelinDec 18, 2007
  8. Andreas EricssonDec 18, 2007
  9. Johannes SchindelinDec 18, 2007
  10. Andreas EricssonDec 18, 2007
  11. Johannes SchindelinDec 18, 2007
  12. Andreas EricssonDec 18, 2007
  13. Jakub NarebskiDec 18, 2007
  14. Andreas EricssonDec 18, 2007
  15. Johannes SchindelinDec 18, 2007
  16. Sergei OrganovDec 18, 2007
  17. Johannes SchindelinDec 18, 2007
  18. Martin LanghoffDec 18, 2007
  19. Wincent ColaiutaDec 18, 2007
  20. Jörg SommerDec 18, 2007
  21. Johannes SchindelinDec 18, 2007
  22. Junio C HamanoDec 18, 2007
  23. しらいしななこDec 20, 2007
  24. Junio C HamanoDec 20, 2007
  25. Wincent ColaiutaDec 21, 2007
  26. しらいしななこDec 21, 2007
  27. André Goddard RosaDec 18, 2007
  28. Martin LanghoffDec 18, 2007
  29. Wincent ColaiutaDec 19, 2007
  30. Martin LanghoffDec 19, 2007
  31. Andreas EricssonDec 19, 2007
  32. Johannes SchindelinDec 19, 2007
  33. Wincent ColaiutaDec 19, 2007

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.