git unstash missing files

Using IntelliJ 13.1.4, I did a git stash on my project and it saved 4 files. 2 were newly created (green font). When I view the stash, I see all 4, but when I apply the stash, the 2 new files don't get recreated, only the two updated files. I can still see the contents if I view source in the stash popup - they are not gone! But they don't get created and I can't tell why. I'm doing this entirely through IntelliJ, so no outside interference with other git clients.

Am I doing something wrong, or could this be a bug? More importantly, is there an easy way to get those files back? I noticed I couldn't even save the files in the source window. I could copy/paste the contents (very kludgy), but I want to avoid this mess in the future.

Thank you,
Philip

5 comments
Comment actions Permalink

Unstash unstashes these new files, but doesn't add them to the index by default. So you can find them in the Unversioned files subtree.

0
Comment actions Permalink

Thanks Kirill, but they're not in Unversioned files, either. It's not that they are missing from the changes window - they are missing from the directory itself.

0
Comment actions Permalink

Please check what happens if you execute stashing, stash inspection and unstash in the command line:

  git stash <- to stash
  git status <- to check that all modifications are moved to the stash
  git stash show --name-status <- to show files which are contained in the most recent stash
  git stash apply <- to unstash (but keep the latest stash)
  git status <- to check what was unstashed.

0
Comment actions Permalink

I had the same problem with "IntelliJ 2019.3.1 (Ultimate Edition)". Popping a stash restored 2 files of a dozen. The rest was *lost!*. I searched with double-shift and in the project explorer, but they were lost. At least it seemed that way. After I opened the main menu and then the "Git" submenu for the 3rd time the files reappeared suddenly.

Git stash popping is just buggy.

0
Comment actions Permalink

"Files > Invalidate Caches / Restart..." after unstash solved this issue for me

0

Please sign in to leave a comment.