The other day I pressed some shortcut while I was checking the left sidebar in PhpStorm and the IDE started deleting the WordPress site's htdocs folder I was working on. It was a local development copy so this didn't cause a site/server downtime at all.

I was pretty quick to cancel the operation, however, it took some time to restore the site to its previous state. Also .git files weren’t restored! I had several WordPress plugins which have several different repositories.

It turns out that PhpStorm/intelliJ IDEA won’t restore any ignored files/folders when you choose to undo a delete action. The JetBrains developers created this ticket and it’s quite possible that it applies to intelliJ IDEA and other IDEs by JetBrains as well.

https://youtrack.jetbrains.com/issue/IDEA-332256

Solution

To remove .git and .svn files from the ignored files and folders list click on the file type and press the delete key or the minus (-) icon above the list.

Windows/Linux: is configured via the File > Settings > Editor > File Types 

tab: Ignored Files and Folders" 

Mac: Preferences > Editor > File Types > tab: Ignored Files and Folders

Here's a video how to remove files and folders from the exclude list

youtube video (with nice background music) - https://youtu.be/YWRd369Eg7U

Why is it important to configure PhpStorm’s ignore file and folder list?

You’re developing a site or an app, you are most likely using some sort of version control system to manage the code, coordinate your and/or your developers’ work. Git is usually a pretty good choice.

Maybe you’ve been working on a WordPress theme or WordPress plugin that’s in version control and accidentally deleted it. PhpStorm won't fully restore it. You’ll have to clone the project/folder again and restore it that way.

I’ve tried replacing the .git folder only but that caused issues. The IDE got confused and wasn’t pulling/pushing things correctly. Maybe I should have cleared the IDE cache.

Referral Note: When you purchase through a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer