'Get back lost shelf changes

I have shelved my 26 java files changes via Intellij Idea 2016.2.1 and I checkout to different branch.

When I came to old branch to check my shelved changes.

I gone a mad now, I lost all the files. I was worked nearly two months

Can somebody help to get it back?



Solution 1:[1]

You can restore the state of those files if they were edited in IntelliJ. Use local history to see all the changes made in IntelliJ (VCS -> Local History -> Show History).

Solution 2:[2]

Even there isn't Shelf tab in IDE you can find shelved changes as patch files at {ProjectName}/.idea/.idea.{ProjectName}/shelf/.idea/shelf.

Then your can apply any selected patch.

Solution 3:[3]

I was able to view lost changes and revert back to them by:

  1. right click on project directory, select Local History > Show History
  2. Find the entry in the history menu that you want to restore. You can examine the files by double clicking on the entry and the files to examine differences.
  3. Right click on the entry you want to restore, and select Revert

Note in my case Git>VCS Operations>Show History showed nothing. Only through the Project Files menu.

Solution 4:[4]

Andrei's answer was helpful for my situation where I renamed my project and my previously shelved changes were no longer found under the shelf, but I did run into an issue when applying the patch file because I was prompted to "Select missing base" for various files in the patch. Similar to what is seen in the screenshot below:

enter image description here https://youtrack.jetbrains.com/issue/IDEA-183910

I was able to avoid having to "Select missing base" for various files by first changing the default shelf location and then applying the patch.

enter image description here https://www.jetbrains.com/help/idea/shelving-and-unshelving-changes.html#change-shelve-location

Also, I found my patch in this location:

{ProjectName}/.idea/shelf

instead of the aforementioned location:

{ProjectName}/.idea/.idea.{ProjectName}/shelf/.idea/shelf

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tcb
Solution 2 Andrei
Solution 3 cnash
Solution 4 Josh