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

[PATCH] git-stash: Make "save" the default operation again

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 2, 2007, 10:44 UTC
Message-ID
<Pine.LNX.4.64.0707021141280.4438@racer.site>
In-Reply-To
<Pine.LNX.4.64.0707021129540.4438@racer.site>

The default operation really should be that which you are most likely to use. And that _is_ to stash the current changes away. Indeed, quite often you will want it to stash away changes you never plan to commit, like extensive debugging output.

Sometimes you will stash away changes that you realize only later will never be needed.

So, neither "list" nor "apply" are ase often used in practice as "save". The manpage already reflects that, so change the script to the better.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	Think about it again. You tested git-stash. That is not the normal 
	modus operandi. You needed to inspect the stashed changes. In the
	examples given in the manpage, you usually want to work with the
	last stashed changes, if at all. So you _rarely_ inspect the 
	stashed changes. From my experience I agree.
	If you make "list" the default, people will get used to _that_, 
	even if it means more typing, and quite a few "Aargh, I just 
	wanted to stash the current state, and I get a list instead!" 
	moments.
	Then there is no way to change it back to some sane default 
	operation.
 git-stash.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index ec18ef6..04ce30a 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -132,7 +132,7 @@ apply_stash () {
 
 # Main command set
 case "$1" in
-list | '')
+list)
 	shift
 	if test $# = 0
 	then
@@ -152,7 +152,7 @@ apply)
 clear)
 	clear_stash
 	;;
-save)
+save|'')
 	save_stash && git-reset --hard
 	;;
 *)
-- 
1.5.2.2.3293.gad30
Previous: Johannes SchindelinNext: Jeff King
Message 26 of 34 in “Add git-stash script”
  1. Add git-stash scriptしらいしななこ, Jun 30, 2007
  2. Johannes SchindelinJun 30, 2007
  3. Add git-stash scriptしらいしななこ, Jun 30, 2007
  4. Jeff KingJun 30, 2007
  5. Junio C HamanoJun 30, 2007
  6. Johannes SchindelinJun 30, 2007
  7. Junio C HamanoJun 30, 2007
  8. しらいしななこJun 30, 2007
  9. Add a manual page for git-stashJohannes Schindelin, Jun 30, 2007
  10. Frank LichtenheldJun 30, 2007
  11. Johannes SchindelinJun 30, 2007
  12. Frank LichtenheldJun 30, 2007
  13. Junio C HamanoJun 30, 2007
  14. Johannes SchindelinJun 30, 2007
  15. Junio C HamanoJun 30, 2007
  16. Johannes SchindelinJun 30, 2007
  17. Document git-stashしらいしななこ, Jul 1, 2007
  18. Junio C HamanoJul 1, 2007
  19. Jeff KingJul 1, 2007
  20. Junio C HamanoJul 1, 2007
  21. しらいしななこJul 1, 2007
  22. Junio C HamanoJul 1, 2007
  23. Johannes SchindelinJul 1, 2007
  24. Jeff KingJul 2, 2007
  25. Johannes SchindelinJul 2, 2007
  26. git-stash: Make "save" the default operation againJohannes Schindelin, Jul 2, 2007
  27. Jeff KingJul 2, 2007
  28. Johannes SchindelinJul 2, 2007
  29. Junio C HamanoJul 2, 2007
  30. Junio C HamanoJul 1, 2007
  31. Add tests for git-stashJohannes Schindelin, Jun 30, 2007
  32. Jeff KingJul 1, 2007
  33. Junio C HamanoJul 1, 2007
  34. Jeff KingJul 2, 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.