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
Wincent Colaiuta <win@wincent.com>
Date
Dec 21, 2007, 07:59 UTC
Message-ID
<56CA16B8-705C-45E5-8BBA-18E7072F2EC6@wincent.com>
In-Reply-To
<7v4pedov6c.fsf@gitster.siamese.dyndns.org>
El 20/12/2007, a las 23:31, Junio C Hamano escribió:
Show 13 quoted lines
> しらいしななこ  <nanako3@bluebottle.com> writes:
>
>> How about making this behavior configurable?
>
> First, as a general principle, I'd like to avoid having commands that
> changes their behaviour drastically depending on who the user is.  It
> makes it harder for people experienced a bit more than totally new to
> help others.  If they are truly experts and are familiar about the
> configuration stash.quick, then they will be fine, but others would  
> say
> "Well, it works for me -- 'git stash' itself won't stash but list.   
> Why
> isn't it working for you, I don't know" and scratch head.

Although the patch is well-intentioned, I totally agree with Junio on this point.

The solution here isn't configuration, but education. Some people have already told how they've been burnt by doing an accidental stash, but how many times does this have to happen to you before you learn your lesson? Once? Twice if you are very unlucky?

And this is not a very painful lesson to learn, seeing as "git stash" is not an inherently destructive operation. In 99% of cases there is no risk of hard-to-reverse "damage". If you accidentally stash, you can just unstash with "git stash apply". I already posted a two-line patch which tells the user how to do this:

http://marc.info/?l=git&m=119799257404542&w=2

The 1% of cases in which "git stash apply" won't work is where the user has unsaved changes in running editors at the time they do the accidental stash. IMO, this is no justification to change the behaviour of stash. Exactly the same is true of other commands that alter the working tree; for example, what happens if you use "git checkout" to switch to another branch when you have unsaved changes in running editors? Are people suggesting that we should change the behaviour of "git checkout" to warn the user that they should save any unsaved changes before continuing and then hit "y"? I think that such a thing would be absurd.

Cheers, Wincent

Previous: Junio C HamanoNext: しらいしななこ
Message 25 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.