1

I was working on stuff. I had to stash it to work on something quickly. Now I want to recover the stuff I was working on. So I run git stash list which gives me this:

stash@{0}: WIP on developers: 044f243 fixing some bugs since address resource

So I run git stash apply stash@{0}. I thought it would bring back all of the files, but it only brought back SOME of the files. When I run git stash list again, I still see the following:

stash@{0}: WIP on developers: 044f243 fixing some bugs since address resource

If I run git stash apply stash@{0} again, then I get the following error:

error: Your local changes to the following files would be overwritten by merge:

I just want to bring back all of the files I was working on before I ran git stash. How do I do that?

Andrew C
  • 13,845
  • 6
  • 50
  • 57
Donato
  • 2,727
  • 6
  • 29
  • 59

1 Answers1

1

Most likely your confusion is caused by the following facts about git stash

  • git stash stores only changes, it doesn't store new files
  • git stash apply applies specified revision, but keeps your stash on the stack. To apply stash and remove it from the stack you may use git stash pop
  • you may re-apply stashed changes multiple times

You may find all the stashed changes with git stash show stash@{0}.

Dima
  • 6,721
  • 4
  • 24
  • 43
  • So how can you retrieve untracked files after a stash? – Donato Oct 21 '14 at 16:07
  • @DanStayntouch if you stashed them, then you can get them back with `git stash pop` (or `apply`, if you will). Otherwise, they will remain unstaged after `git stash` and their future is in your hands. – Dima Oct 23 '14 at 21:44
  • if the changes are listed in the stash, i expect them to be applied. Whats confusing about that? – StingyJack May 24 '21 at 13:54