Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 .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 ?

like image 542
Pierre Henry Avatar asked Mar 19 '15 08:03

Pierre Henry


People also ask

How do I get shelve changes in IntelliJ?

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.

How do I see shelves in IntelliJ?

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.

How do I show local changes in IntelliJ?

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.

What does it mean to be shelved?

to put off or aside from consideration: to shelve the question. to remove from active use or service; dismiss.


1 Answers

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 Shelf Tab.

If you don't see your .idea folder in your IDE, follow these steps:

  1. Help > Find Action...
  2. Search "Registry" and click the found action See attached screenshot
  3. In the Registry search "dot.idea" and uncheck the checkbox in the Value column for the projectView.hide.dot.idea Key See other screenshot
like image 130
Randy Avatar answered Oct 02 '22 14:10

Randy