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

Re: Newbie question: Is it possible to undo a stash?

From
JHJean-Luc Herren <jlh@gmx.ch>
Date
May 14, 2008, 20:51 UTC
Message-ID
<482B50DC.3020400@gmx.ch>
In-Reply-To
<509f40850805141256gce6ac1brf5ced6436f81dae8@mail.gmail.com>
Hello!
Iván V. wrote:
> I just did a git stash, and then changed my mind and ran git apply,
> thinking that would get me back to where I was...

Certainly you mean "git stash apply". "git apply" is something different.

Show 5 quoted lines
> Now I have lots of conflicting merges and files that came back from
> the dead (and some files seem lost)... I've been trying to go step by
> step to try to get the tree to where it was, but it's very
> complicated, so I was wondering if there is anything I can do to get
> my working tree exactly to where it was before I ran git stash...
git stash pop --index

I think that should get you exactly where you were before "git stash". The --index makes it also restore the index, which wouldn't happen by default. Using 'pop' instead of 'apply' makes it remove the stash after re-applying it.

jlh
Previous: Jakub Narebski
Message 3 of 3 in “Newbie question: Is it possible to undo a stash?”
  1. Iván V.May 14, 2008
  2. Jakub NarebskiMay 14, 2008
  3. Jean-Luc HerrenMay 14, 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.