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 .idea/shelf
.
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 ?
Apply external patches You can import patches created inside or outside IntelliJ IDEA and apply them as shelved changes. In the Shelf view, choose Import Patches from the context menu. In the dialog that opens, select the patch file to apply. The selected patch appears in the Shelf tab as a shelf.
This tab is added to the Version Control tool window Alt+9 when you shelve a change or a changelist, and is displayed until you permanently remove all shelved changes, including the already unshelved ones, and imported external patches.
With IntelliJ IDEA you can restore that change in a couple of clicks. Right-click anywhere in the editor and choose Local History | Show History from the context menu. In the dialog that opens, the left-hand pane shows a list of all saved revisions of the current file with timestamps.
to put off or aside from consideration: to shelve the question. to remove from active use or service; dismiss.
If you are ever lose the Shelf tab in a Jetbrains IDE, you may have shelved too large of a file (a 1.81 GB .patch in my case). You can view all of your patches in the Jetbrains shelf by going to: /.idea/shelf
Delete the really large patch file and restart the IDEA and the Shelf tab reappears on the Git area .
If you don't see your .idea folder in your IDE, follow these steps:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With