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

Asymmetric default behavior of git stash

From
USUwe Storbeck <uwe@ibr.ch>
Date
Aug 27, 2013, 14:07 UTC
Message-ID
<20130827132210.GA14266@ibr.ch>
Hi,

is there any reason why the default behavior of git stash is asymmetric?

When I save my current state with 'git stash save' it saves the worktree changes and the index changes (and resets both). When I restore the state with 'git stash pop' it restores the worktree changes, but not the state of the index. Your work preparing the index is lost.

Although this behavior is documented it is kind of unexpected. From a save-restore mechanism I would expect that the default behavior would restore the state as it was before the save. So I would expect it to either save and restore the worktree and leave the index alone or save and restore both, the worktree and the index.

Regards
Uwe
Message 1 of 1 in “Asymmetric default behavior of git stash”
  1. Uwe StorbeckAug 27, 2013

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.