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

Re: [PATCH] Add a manual page for git-stash

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 30, 2007, 17:44 UTC
Message-ID
<7vps3dcp76.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0706301644190.4438@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 21 quoted lines
> +DESCRIPTION
> +-----------
> +Use 'git stash' when you want to record the current state of the
> +working directory and the index, but want to go back to a clean
> +working directory.
> +
> +For example, if you have to pull, but are in the middle of some
> +interesting work, not yet ready to be committed, use git-stash.
> +
> +The default operation (when called without options), is to save
> +the changes away.
> +
> +
> +OPTIONS
> +-------
> +clear::
> +	Undo _all_ stashes (dangerous!).
> +
> +list [<stashname>]::
> +	List all stashed states.
> +

I suspect that is not what the implementation intends to do. "list -n 4", "list --since=1.hour" would make sense, but "list stash@{12}" would probably not.

> +show [<stashname>]::
> +	Show a combined diff of the stashed working directory, index and
> +	HEAD.

Is that what it does? I had an impression that "show stash@{2}" shows a regular diff between the base and the stashed working tree state.

> +apply [<stashname>]::
> +	Try to apply the stashed changes to the current HEAD. You need
> +	a clean working directory for that, i.e. you must not have changes
> +	relative to HEAD in your working directory or index.

The implementation appears to apply on a clean index without restriction to where the HEAD is. I hinted that that behaviour is fine in my previous message, but on the other hand haven't convinced myself enough to say that it would not confuse end users. Maybe insisting on not just clean index but no changes from the HEAD would reduce confusion? I dunno.

> +<stashname>::
> +	A name of a stashed state. Typically something like 'stash@{2}'
> +	or 'stash@{2.days.ago}'.

Probably this should be defined in DESCRIPTION, along with the definition of what a stash is ("records the difference between the HEAD when the stash was created and the working tree state in such a way that it can be applied to a different state later").

Show 18 quoted lines
> +DISCUSSION
> +----------
> +
> +The state is saved as three commits:
> +
> +- HEAD,
> +- a commit which contains the state of the index, which has HEAD as a
> +  parent, and
> +- a commit which contains the state of the working directory (only the
> +  tracked files, though), which has both HEAD and the second commit
> +  as parents.
> +
> +The third commit holds the complete information of the stash, and is
> +stored as the ref 'refs/stash'.
> +
> +Since that commit does not have any reference to other stashed states,
> +the stash listing relies on the reflog of 'refs/stash'. Therefore,
> +the stashed states are garbage collected like all the other reflogs.
Nit; s/the other reflogs/the other reflog entries/
> +Author
> +------
> +Written by Johannes E. Schindelin <johannes.schindelin@gmx.de>
You wrote that ;-)?
Previous: Frank LichtenheldNext: Johannes Schindelin
Message 13 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.