How to restore shelved changes in Intellij when the shelf tab is not shown?
I tried to use the “shelf” feature for the first time in IntelliJ IDEA today. I shelved all my current changes so that I could work on a quick bugfix, commit it, and come back to my current work afterwards.
When I commited the “shelf” action, IntelliJ created the shelf and I could see it in the tool window. Then it reverted, and reloaded the project.
Now the shelf tab in the Changes tool window does not appear any more.
However in the file system I can see the patch file under
Why ? I suspect the problem is that the
.idea directory is itself under version control. So when I shelved the changes, it file was included in the shelved changes, and then it was reverted, and IntelliJ is not aware of the shelved changes any more.
I am using Git.
How can I make IntelliJ aware of the patch file in the change tool window ? Or if impossible how can I restore these changes based on the patch file only ?
And how to use this feature in the future without encountering this problem ?
Is it a bad practice to keep the
.idea directory in te VCS ?
One Solution collect form web for “How to restore shelved changes in Intellij when the shelf tab is not shown?”
The answer to the
How can I make IntelliJ aware of the patch file in the change tool
question was :
Create a bogus shelved change so that the “shelf” tab is available. It will not show if there are currently no shelved changes.
Right click in the “shelf” tab, select “import patch file”, pick the previously create patch file. This creates the “shelf”
You can now “unshelf” the changes normally
Finally, I had to manually merge the workspace.xml file. After this, I think I will think about stopping to commit IDE project files to VCS. At least when it is a trivial task to recreate the IDE project from e.g. a checked out Maven project.