# Can I retrieve changes from deleted stash?

3 messages from 2009-10-05 to 2009-10-05. Participants: Daniel, Thomas Rast, mjucde.
Thread: https://gitlist.dev/t/21133

## Daniel, 2009-10-05 12:05

Subject: Can I retrieve changes from deleted stash?
Message-ID: <c18a43e.55008170.4ac9e127.2a972@o2.pl>
URL: https://gitlist.dev/e/c18a43e.55008170.4ac9e127.2a972%40o2.pl

```
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.

```

## Thomas Rast, 2009-10-05 12:30

Subject: Re: Can I retrieve changes from deleted stash?
Message-ID: <200910051430.17559.trast@student.ethz.ch>
URL: https://gitlist.dev/e/200910051430.17559.trast%40student.ethz.ch
In-Reply-To: <c18a43e.55008170.4ac9e127.2a972@o2.pl>

```
Daniel wrote:
> 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

```

## mjucde, 2009-10-05 12:50

Subject: Re: Can I retrieve changes from deleted stash?
Message-ID: <49b3d318.78c3c971.4ac9eba0.1181@o2.pl>
URL: https://gitlist.dev/e/49b3d318.78c3c971.4ac9eba0.1181%40o2.pl
In-Reply-To: <200910051430.17559.trast@student.ethz.ch>

```
Thomas Rast <trast@student.ethz.ch> wrote:

> Daniel wrote:
> > 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
> 

Thanks, that did the trick :)

```
