1

I did a stash with many local file modified. Once I did a pull request to update my project, this stash has been applied with nothing inside.

How can I recover all lost modified files?

Istorn
  • 485
  • 1
  • 5
  • 23
  • 2
    Do you still see it in the stash list? (`git stash list`) – Romain Valeri Apr 01 '19 at 14:38
  • 2
    Also try doing `git stash show -p` ... do you see a diff which is what you expect? – Tim Biegeleisen Apr 01 '19 at 14:38
  • Afraid not: it isn't anymore in the stash list and no... I can't see the diffs I hope to see (only 1 file vs. at least 7 different I'm expected to see) – Istorn Apr 01 '19 at 14:40
  • Are you sure the changes contained in the stash haven't already been applied by the PR, making the stash obsolete? Also, if the garbage collector did not run, you can recover popped stashed as follow: https://stackoverflow.com/questions/89332/how-to-recover-a-dropped-stash-in-git – padawin Apr 01 '19 at 14:54
  • Unfortunately, yes. The stash has been directly overwritten and removed. I had to check into the garbage collector as you mentioned: I had a dangling commit which, thanks lucky, was still alive. @padawin I guess we need to make this question as "duplicate" or make your with the right answer you provided :) – Istorn Apr 04 '19 at 08:06
  • I am not sure how to mark a question duplicate, so I posted my solution as answer. If someone can mark the question as duplicate, please feel free to. – padawin Apr 04 '19 at 08:19

1 Answers1

1

Dropped stashes are still available until the garbage collector runs, you can find stash commits as described here: How to recover a dropped stash in Git?

padawin
  • 4,230
  • 15
  • 19
  • As I've already written, I found a dangling commit which contains the stash overwritten. It was the only fully functional solution to recover the overwritten local files. Thanks again! – Istorn Apr 04 '19 at 08:21