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

Re: Can I retrieve changes from deleted stash?

From
Thomas Rast <trast@student.ethz.ch>
Date
Oct 5, 2009, 12:30 UTC
Message-ID
<200910051430.17559.trast@student.ethz.ch>
In-Reply-To
<c18a43e.55008170.4ac9e127.2a972@o2.pl>
Daniel wrote:
Show 11 quoted lines
> I did:
> 
> $ git stash
> $ git pop
> 
> $ git checkout -- <modified files>
> 
> Now I don't have changes I stashed. I guess the blobs with stashed
> files should be somewhere?  Is there any way I can get back my changes?
> I tried to use git-reflog, but I'm not sure how can I find the files
> I need.

The problem is that the stash itself is a reflog, so there is no extra safety layer.

Recent versions of the git-stash(1) manpage[*] document a command that helps find the stashes: if you do not explicitly name them, the they will be called "WIP on <subject>" and can thus be found with

  git fsck --unreachable |
  grep commit | cut -d\  -f3 |
  xargs git log --merges --no-walk --grep=WIP
[*] you can find a bleeding edge version at
  http://www.kernel.org/pub/software/scm/git/docs/git-stash.html
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: DanielNext: mjucde
Message 2 of 3 in “Can I retrieve changes from deleted stash?”
  1. DanielOct 5, 2009
  2. Thomas RastOct 5, 2009
  3. mjucdeOct 5, 2009

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.