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

Re: [PATCH/RFC] stash: introduce 'stash save --keep-index' option

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 27, 2008, 18:26 UTC
Message-ID
<7vlk0qrayk.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080627143715.GD6747@neumann>
SZEDER Gábor <szeder@ira.uka.de> writes:
Show 7 quoted lines
> 'git stash save' saves local modifications to a new stash, and runs 'git
> reset --hard' to revert them to a clean index and work tree.  When the
> '--keep-index' option is specified, after that 'git reset --hard' the
> previous contents of the index is restored and the work tree is updated
> to match the index.  This option is useful if the user wants to commit
> only parts of his local modifications, but wants to test those parts
> before committing.

Please do not describe how it does, before what it does and what it is good for. Here is an example:

	When preparing for a partial commit (iow, committing only part of
	the changes you made in your work tree), you would use various
	forms of "git add" to prepare the index to a shape you think is
	appropriate for committing, and finally run "git commit".
	This workflow however has a flaw in that you are committing
	something that you could never have tested as a whole (and without
	any other modification) in your work tree.
	With the new "--keep-index" option, "git stash" takes a snapshot
	of your index and the work tree state, and updates the work tree
	to match your index, i.e. what you are about to commit.  This way,
	you can commit with confidence, knowing that you are committing
	what you saw (and hopefully tested) as a whole in your work tree.
	After making that initial commit, "git stash pop" will bring the
	work tree state back without touching the index, so you can start
	the next cycle of "git add" to prepare the second batch.

I do not know if your --keep-index implementation would actually allow the above workflow; I haven't read the patch.

Previous: SZEDER GáborNext: Robert Anderson
Message 4 of 57 in “An alternate model for preparing partial commits”
  1. Robert AndersonJun 27, 2008
  2. Björn SteinbrinkJun 27, 2008
  3. stash: introduce 'stash save --keep-index' optionSZEDER Gábor, Jun 27, 2008
  4. Junio C HamanoJun 27, 2008
  5. Robert AndersonJun 27, 2008
  6. Björn SteinbrinkJun 27, 2008
  7. Robert AndersonJun 27, 2008
  8. Johannes SixtJun 27, 2008
  9. Robert AndersonJun 27, 2008
  10. Petr BaudisJun 27, 2008
  11. Robert AndersonJun 27, 2008
  12. Johannes SchindelinJun 27, 2008
  13. Miklos VajnaJun 27, 2008
  14. Robert AndersonJun 27, 2008
  15. Johannes SchindelinJun 27, 2008
  16. Robert AndersonJun 27, 2008
  17. Dana HowJun 27, 2008
  18. Stephen SinclairJun 27, 2008
  19. David JeskeJun 27, 2008
  20. David JeskeAug 13, 2016
  21. Wincent ColaiutaJun 28, 2008
  22. Dmitry PotapovJun 28, 2008
  23. Robert AndersonJun 28, 2008
  24. Dmitry PotapovJun 28, 2008
  25. Junio C HamanoJun 27, 2008
  26. Robert AndersonJun 27, 2008
  27. Jeff KingJun 28, 2008
  28. Robert AndersonJun 28, 2008
  29. Jeff KingJun 28, 2008
  30. Junio C HamanoJun 28, 2008
  31. Johannes SchindelinJun 28, 2008
  32. Jeff KingJul 8, 2008
  33. David JeskeJun 27, 2008
  34. Jakub NarebskiJun 27, 2008
  35. David JeskeJun 27, 2008
  36. David JeskeAug 13, 2016
  37. David JeskeAug 13, 2016
  38. Robert AndersonJun 27, 2008
  39. Robert AndersonJun 27, 2008
  40. Junio C HamanoJun 27, 2008
  41. Robert AndersonJun 28, 2008
  42. Dmitry PotapovJun 28, 2008
  43. Robert AndersonJun 28, 2008
  44. Stephen SinclairJun 28, 2008
  45. Robert AndersonJun 28, 2008
  46. Robert AndersonJun 28, 2008
  47. Jakub NarebskiJun 28, 2008
  48. Robert AndersonJun 28, 2008
  49. David JeskeJun 28, 2008
  50. David JeskeAug 13, 2016
  51. Stephen SinclairJun 28, 2008
  52. David JeskeJun 28, 2008
  53. David JeskeAug 13, 2016
  54. Fwd: An alternate model for preparing partial commitsRobert Anderson, Jun 28, 2008
  55. Dmitry PotapovJun 28, 2008
  56. Robert AndersonJun 28, 2008
  57. Dmitry PotapovJun 28, 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.