PyCharm How to restore deleted file

PyCharm can easily restore deleted files from your Project by few clicks without even using 3rd party tools or file system. The way to get back accidentally deleted a files from your system:

  • Go to Project Pane
  • Right Click
  • Select Show history / Local History
  • You can see all changes in the current project
    • impacted files
    • timestamp
    • Action
  • Select the operation which cause the deletion
  • Revert

In my case I did some changes on the master which were suppose to be done in different branch. So I created the new branch and did commit and push. Then I switched back to the master where I saw the same files except one which made me suspicious but I didn't pay much attention.

Ten I reverted the local changes (which was equal to deletion) few minutes after I found my mistake. Several hours of work, dozens of Python lines, my brilliant logic were lost.. Luckily I remember that there is local history in PyCharm. Lucky me my code was saved. Thanks PyCharm!

Note: It works even when the PyCharm is closed and reopen.

Step 1. Open Local history


Step 2. Preview changes

Step 3. Revert the deletion of the files


This great feature is available also in IntelliJ, PhpStorm, WebStorm etc.

Share Tweet Send