Using Local History to restore deleted files

Suppose you have accidentally deleted a file from your project, and want to have it back. Sure, you can restore it using the file system, but IntelliJ IDEA suggests a better way to do it, without leaving the IDE.
This is where IntelliJ IDEA’s local history on the project or folder level comes to help, preserving all modifications that affect the nested files, including the changes to the contents and to the file tree in general. Each change is marked with its time stamp, revision, and action description. Unlike version control that keeps track of the committed revisions only, the local history preserves all local changes you make as you edit, compile or test, during few days (it is up to you to define how long you want this history to be). This “personal version control” will help us restore the deleted file.
In the example below, a file Lost.txt has been deleted from the FontChooser project. Let’s try to restore it. Go to the Project tool window and right-click the project node or just a folder, where the file used to exist:

On the context menu, choose Local History, and click Show History on the submenu:

The local history view for a project or folder shows you everything that you have done during the last few days. In the Action column of the lower part of the dialog box, select the action you want to roll back. In our case, this is the “Deleting” action. So doing, the upper part of the dialog box shows the tree view of changed files.
If you want to restore the deleted file only, regardless of the other changes that have been done since then, you can select the file Lost.txt in the tree view and click the Revert button on the upper toolbar. The file will be restored silently.

A different situation occurs, if you want to restore the deleted file and the whole project or folder state as of a certain revision. In this case, place the cursor on the revision prior to the “Deleting” action, or on the action itself, and click the Revert button on the lower toolbar. If the other files have been changed since the “Deleting” action, you will be prompted that the other changes will be reverted too. Look again at the Project view — our file is here:

Technorati tags: ,

This entry was posted in Tips & Tricks and tagged . Bookmark the permalink.

172 Responses to Using Local History to restore deleted files

  1. Ken Orr says:

    This feature saved me! Our source control system devoured one of my files and left not a trace of it behind. IntelliJ’s local history saved me, as it new the file was there before, and let me salvage its contents.

    This is a fantastic feature!

  2. Irina Megorskaya says:

    Hi Ken !

    Thank you very much for your positive feedback :)

  3. Mike D says:

    Hey! Major thanks for posting this — you just saved my entire week of “uncommitted” work. And to think the IT guys said I was SOL. You rock!!

  4. Rob says:

    I have a disaster recovery situation I’m in the middle of, and wondering if this feature might help me out. I actually lost several project directories, whole and complete. Am trying a number of things at the moment, but I’m du’ing against the .Intellij10 directory and I see a phat system/caches directory; I’m convinced my local history is just locked up in there.

    Is there any way I can access this cache? I’ve started and quit IntelliJ only once since the incident; when I loaded it up (of course) it couldn’t load my last project because it didn’t find it; and it wasn’t available in “Reopen projects->” list…

    Any thoughts/help would be appreciated!


  5. Someone says:

    Thank you for this amazing feature!
    Just recovered two days work…

  6. Alexander says:

    My source directory was completly removed! And I get all code back with this amazing feature… THANK YOU!

  7. Frank says:

    Now this is what I call a *seriously* butt-saving feature. Thank you. Bleary eyed and tired I accidentally wiped out a directory of important files, and then synched with my production server, which of course wiped the files out on the server. I spent all day trying to recover them with search and recovery programs. I was just about to give up and jump off a cliff when I poked around and found the local history. I recovered everything and restored close to a month’s worth of work.

    I learned two lessons:

    1) PHPStorm rocks.
    2) Only idiots work without some sort of versioning system.

    Thank you for adding this excellent feature.

  8. mike says:

    Thanks for this! I also accidentally removed a whole day’s work with a misplaced git reset, and thankfully, I was able to restore everything with this feature.

  9. hangtwenty says:

    this just saved a week of work. thank you so much.

  10. Suseika says:

    Helped me to restore a couple of files that appeared to be untracked by Git after a sudden outage. Praise IDEA!

  11. Oleg says:

    You are the best, thanks for this option, it helped me :)

  12. Nicholas Pickering says:

    Local History has triumphed again! Without it, I would’ve lost 3 days worth of work. Thanks, IDEA.

  13. ed austin says:

    Saved a whole evenings work that would have been real hard to replicate!!!
    You guys rock!!

  14. Calum says:

    I love this feature. Just saved me from redoing a few hours of work. Thanks!

  15. Ahrar says:

    great feature :) Thanks

  16. Shaun says:

    SAVED! awesome feature!

  17. Itay says:

    Great solution,

  18. grub says:

    Saved me two days!
    Thank you!

  19. gheorghei says:

    A nasty commit to SVN wiped out a fat import script AND its output. Two days of work, and I only had hours until the life-changing demo of our product.

    Thank you, thank you, thank you!

  20. dmitiryl says:

    Woups… saved my evening)

  21. Russ says:

    This feature just saved my work, my project, my marriage, and my life.

  22. Mateo says:

    Years and years of saved work!
    You rock guys!!

  23. Randy says:

    Thank you for this! Accident delete the file and save my time! I should have commit the files first.

  24. Seyi says:

    Killer feature. One more reason toy IDE’s don’t stand a chance!

  25. Ben Haran says:

    Reading through all the comments really made me happy now, look at all those people who’s work is saved!

    Of course, I arrived here, after it save one of my files…

    And good job :) I hope it doesn’t cost much in performance!

  26. The best kind of software feature, crash protection! Next time I promise I won’t wait so long to commit and push 😉

    (AND remember, git commit -a -m does not add completely new files)
    “-a, –all
    Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.”

  27. Fernando says:

    +100000 from my side!!!
    This feature just saved me loads of time trying to recover from the backup after an accidental rm *

  28. Urosh says:

    Thanks so much for this!

    I did a backup of a project I was working on but forgot to save a file I was modifying locally. So the backup did an overwrite over it and I lost all my work.

    Thanks to this I got my old file back and saved a lot of time!

  29. Zsolt says:

    This saved my day work! I did a git reset –hard before I commited my changes and this was the only way to restore my files!

    Pycharm (and jetbrains) rock!

  30. gReg says:

    Thank you so much! What a nice feature.

  31. Lee Grey says:

    This feature saved me an entire evening’s worth of work. IntelliJ is the best!

  32. Lukas says:

    Saved my life right now – Intellij best IDE of the world!!

  33. Dmitry says:

    Wow, thank you. Restored hours of written code in a file I some how deleted without knowing.

  34. Sampene says:

    I just got saved with this feature.Amazing, Thanks

  35. Ola says:

    Thanks buddy you saved me….

  36. Adnan says:


    You saved my life…

    It was amazing to recover deleted file… just 13 recoved files….


  37. Pat Garcia says:

    Dude!! i know this thread is old as hell but you just saved my butt. Thanks!!!!

  38. Andrew Nyago says:

    This saved my life too.

    Had been working on a File the whole day (more-over if Friday) when a power outage caused my file to “disappear”.

    This feature saved my day and my weekend.

  39. Moushumi says:

    how to retrieve a file a new file which is just created, if it gets deleted due to system crash.

  40. choirul anam says:

    Thank’s very much, this solution is save my time. I was lost my php project located under bin-debug folder because affected by ‘cleaning before compile’.

  41. Suresh says:

    Thank you so much IntelliJ, you saved my valuable 5days work.

  42. Ademola 'Jeda says:

    I was down after I deleted my repo my mistake but this tutorial saved my day!!!

    many thanks

  43. Alexander says:

    Thanks. You saved my life!!!))

  44. Andreas Greece says:

    I was in cold sweat for an hour and then I found it. 2 weeks of hard work saved !! Thank you for this!

  45. John Milo says:

    Now I love Rubymine even more.

  46. Ruchir says:

    Thanks a lot… +1

  47. Alexandr says:

    Amazing feature. Thank you a lot. You are the best high skilled engineers because you have made up this thing!!!

  48. Jemima says:

    You saved my ass! I love you!

  49. Shon Diaz says:

    I could cry… i accidentally rm a script file that was not yet in the repository. It was the same name as a log file and powershell tab name completion screwed me! I googled a data recovery that did not work. I was about to give up hope when i saw this thread.. LIFE SAVER! I was sold before because of excellent nodejs support, but now this is my favorite ide. (sobs)

  50. mona says:

    My butt was saved :) I like how this article has lasted 6 years with all the happy commenters!

  51. Loredana Elena - Radu says:

    Is working fine too with CTRL+Z in the Project part not in a file.

  52. Bastiaan says:

    Thank you, thank you, thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  53. Jakub says:

    Save a lot of work :) Thanks!

  54. nathzeleke says:

    I have lost words to express my gratitude for jet brains. You have saved me a lot of work. Thank you very much.

  55. Steve says:

    This feature saved me one week of hard work, phewww…
    Many thanks!!!

  56. Attila Fulop says:

    It has saved me 3 hours of work that hasn’t been pushed, but overwritten by a composer update.

  57. Abdur Jabbar says:

    +1 for saving my ass. Great feature!

  58. Vinicius says:

    This is indeed a great feature. Just saved me now. Thank you.

  59. Trevor Scheer says:

    Just another person here to thank you for such a wonderful feature. I had already given up and gone to plead with the teacher about losing 3 (full) day’s work when it popped into my head that there may be something in IntelliJ that could save my butt.

    Already a fantastic IDE, but you’ve earned a loyal customer once my student membership is up.

  60. Andrei Ordine says:

    Awesome feature! Saved 2 days of coding

  61. Sami Awwad says:

    Praise the Intellij Gods for this feature!
    I accidentally clobbered a file with a perforce resolve and was able to get it back using this feature.

  62. GJ says:

    This saved my life.. Really thank you!!!!!

  63. Gupta says:

    Thank you for this post!

  64. Sunil says:

    i faced a problem of “” deleted from project accidentally, i tried almost all the technique to retrive it, since my VCS was not configured. so i find it very easily by browse console history, and i just copied the whole code :)

  65. Krishna says:

    Thanks for the post. Helped us a lot.
    Saved time and efforts.

  66. ktou says:

    Oh really nice feature, you saved me !

  67. Island Pinnick says:

    This just saved me as well! Thank you guys for making suck an awesome product!

  68. marvine says:

    This is Fantastic…

  69. Harry says:

    Love this feature saved me a lot of stress and headache today. Love Intellij

  70. Vineet says:


  71. You save my life, really i mean it.

  72. Arjun CHATTERJEE says:

    The local history feature Seriously Saved me 10 hours of work!
    I wanted to do: rm tmp/*
    But i accidentally did: rm * tmp
    And lost all of my code!

    Thankfully Jetbrains is the Best IDE in the universe, it saved me!

  73. AZOR says:

    + one saved life, I created file starting with A, click on the last file in the folder and remove it .. the wrong one of course…

    Jeden soubor ale na rozmrdani celeho projektu to stacilo..

  74. alex says:

    Oh, I just being saved by this feature as many more before me.

  75. sebastian says:

    I love this feature, I had lost hours of work due to an uncommited git reset –hard!!!!!!!!!

  76. ron says:

    wow !
    life saving feature tyvm!!

  77. random shitty developer that hardresetted by mistake says:

    thank you so much, Whoever wrote this amazing piece of software is the greatest person alive!

  78. VIKAS KOHLI says:

    This feature saved me!
    Thank you PyCharm ide

  79. Francis Kim says:

    What a life saver this feature is!

    I thought my WebStorm was frozen/stuck at first but it just took its time. All my files are restored after a stupid rm *

  80. Edmond says:

    You save me !

  81. Alex says:

    Saved my life @ work. Thank you !

  82. Sohail Khan says:

    butt got saved. can confirm

  83. This just saved me a pain of re-writing thousands of lines of code after a power outage tripped my debian pc off. Thanks

  84. Jim Mullen says:

    Worked for me after doing a git reset –hard ! Thanks!

  85. Kavya says:

    Webstorm continues to amaze. Well worth money

  86. Vannat says:


  87. abdou says:

    Thanks very much….!

  88. Lee says:

    You have no idea how grateful I am for IntelliJ Idea, I almost got a heart attack when I saw one of my java files disappeared. I came across this article and it really saved me. I had been working on a project this weekend and made so much progress and thought I’d lost it all, but thanks to this intelligent IDE I was able to recover my data.

    I’ve never felt the need to pay for a software product before, but this IDE is so amazing I am going to go ahead a purchase a license for it. It is totally worth the price.

    Thanks once again to the team at JetBrains, you are truly phenomenal.

  89. Haik says:

    thanks, saved me

  90. Ankit says:

    I am using InelliJ IDEA 2016.25 .It gets closed automatically and on reopening all my settings and projects got deleted ,not able to recover also very annoying faced mulitple times the same isse

  91. zenwarr says:

    God bless you, guys

  92. Tuatini says:

    So much thanks for this. This saved me a day of work.

  93. Mark says:

    Praise the lord Intellij is my IDE, feature saved me !

  94. timefrenzy says:

    Thanks for that funcationality, that saved my a lot of work. I accidently deleted the work of some hours.

  95. simpleman19 says:


  96. John says:

    Thanks so much u have saved me

  97. Tatiana says:

    Helped me after a dumb gitignore-related accident today. Thanks!

  98. Slava says:

    Omg thanks very much, my ass has been saved

  99. Pavel Vasev says:

    Thank you very much for this feature! You saved 4 days of my work..

    Especially thank you for that you store history outside of project directory. I deleted my project directory because I thought it was pushed to git.

  100. Nikita says:

    I love you guys! You save my four days work!
    I know, I have to commit every day, but… :) Many thanks for feature “Local changes” on folder!!!
    (closer to above situation: I made checkout –force and didn’t think what could be happened)

  101. Sebastian says:

    I accidentally deleted my entire src directory instead of just one header file in it as I was cleaning it up to do an initial checkin to my VCS. Eight hours of work would have been down the drain were it not for this article and CLion.

    Huge relief!

  102. Arg0s says:

    God save your fucking brains!!!

    Thank you so so much!!

  103. Pemedina says:

    And, 10 years after 1st post. this feature keeps saving souls. Hell would be overpopulated without this.


  104. Talat says:

    My favorite saver fatureeeeee!!!!! :) thank you thank you !!

  105. Italo says:

    This saved my life! Thank you very much for this feature!

  106. Alireza says:

    this saved me life thanks jetbrains

  107. Tatiana says:

    “Why put this temporary project under source control, I’ll move it tomorrow to another one”. That’s why! Tried to move all project files as a subdirectory in another project and things went terribly wrong.
    This feature saved me two days of work.

  108. krishna singh says:

    Sorry, but it didn’t helped me. I reverted all the changes that I had made but still couldn’t find my web.xml file. I don’t know how it got deleted. I just made changes in my dispacther-servlet.xml file. Then run clean and package in maven. After running package I got the error of couldn’t find web.xml file in the location.

  109. Ahmed Abdeldaim says:

    Oh My God .. What a genius features, i have restored a whole folder with it which saved my life. thanks a lot.

  110. saeed says:

    Really tanks to php storm and u.

  111. Kiril Minkov says:

    Thanks a lot! This is the best idea ever. You rarely need it, but when you do it saves you great deal of hassle.

  112. svarlamov says:

    Awesome feature!

  113. Mikle Talalaevskiy says:

    Thank you

  114. Hamzah Tossaro says:

    Live saver!!

  115. Rana Saha says:

    Thanks. Just saved me a lot of time.

  116. thir13en says:

    What can I say… <3 forever guys!!!

  117. Makkenza says:

    Very useful, especially after the vacation 😀

  118. Bukky Olawoyin says:


    This saved my neck!

  119. Drew says:

    THANK. YOU. You just saved my project. Thank you so much.

  120. Edwin says:

    Excelente aporte me han salvado la vida!!

  121. Joel says:

    This saved me as well. So thankful.

  122. Jonathan Banin says:

    The person who thought of this should get promoted.
    Seriously, thanks!

  123. Dmitry Shultz says:


  124. Mithin Reddy says:

    awesome feature

  125. Mahima Choudha says:

    Thanks very much..

  126. Radek says:

    Thank you! Really excellent feature of IntelliJ!

  127. Wilson Ong says:

    Got back my accidentally deleted files 😀

  128. Tara says:

    Bless you! I just recovered work I thought I had lost!

  129. AsHappyAs - A new breed of social media says:

    Excellent feature – helped us recover 2 days lost work!

  130. Leandrit Ferizi says:

    Great feature, lots of thanks. Saved a good chunk of my day

  131. Rajyalaxmi says:

    AWESOME..!!! Thanks

  132. Vijay Venkataraman says:

    Saved me. Wonderful feature.

  133. Torbjørn says:

    I’m amazed that this worked even after deleting the project directory itself – including .idea/ and .git/.
    At first I was annoyed by how IntelliJ immediately closed the files I had open (which contained most of my unpushed work), but with this feature I can understand why!

  134. MAHIMA says:


  135. Moses says:

    Please any idea on how to recover lost files on pycharm

  136. Dear JetBrains developers.

    I accidentally deleted an entire folder containing many changes (about 9 hours of work) unpushed to the online repository. After a lot of tries using many Linux tools, I had the idea to search any history feature in CLion and I found this post. Oh my, *YOU SAVED MY LIFE!* :’-)

    Thank you very much for your awesome tools!

  137. Sankarganesh says:

    The critical feature of IDE than auto-complete, saved my work.

    Long live intelliJ !!!

  138. Sergio says:

    Made my day 😀

    Thanks IntelliJ!!

  139. Rodrigo Boratto says:

    Thank you JetBrains! Life saver!

  140. Yeet says:

    I did this and It corrupted zip/rar files, mp3/wav. How do I fix that

  141. Melvin Yin says:

    Accidentally did a shutil.rmtree(project_directory) while debugging. Last commit was nearly a day ago (I know). This just saved my one whole day of work, thanks guys. Seriously, thanks.

  142. Jacob Schneider says:

    I accidentally deleted my *Whole* project. Thank god for IntelliJ, I would have screamed. I just wanted to drop a comment to say thank you for the gods at Jetbrains. What a bunch of legends.

  143. Pablo says:

    Best feature ever!

  144. ps says:

    AMAZING feature!!!

  145. ps says:

    Thank you.. This is amazing feature..

  146. serg says:

    THANKS!!!!!!!!!!!!!!!!!!!!YOU SAVE ME!!!!!!!!!!!!!!!!!!!!

  147. raftaar1191 says:

    Thank you very much

    You save me !!!!!!

  148. someone says:

    Thank you!!!

  149. Anton says:

    awesome feature!
    Thank you!!!

  150. jake says:

    Thank you so much!!!

  151. Lucas says:


  152. Peter Westlin says:

    Local history is still going strong – woohoo!

  153. Nikolay says:

    This feature just saved me 30 hours of work! Brilliant, thank you!

  154. Maheep says:

    Wow Thanks
    Saved me!

  155. Ry says:

    Just turned my panic attack into time for a beer. Cheers to this lifesaver!

  156. Sandeep says:

    This is best feature thanks

  157. aykon says:

    Where can I sent Beer and Cake???

  158. Sweta says:

    This saved me!!

  159. Athanus says:

    Thanks buddy, saved my whole project

  160. Partho says:

    thanks a Lot jetBrains..

  161. Jose says:

    This 12-year-old feature just saved me, thank you JetBrains for creating such good products.

  162. Razvan says:

    JetBrains rocks! I just recovered the work I did for the last 2 days!

Leave a Reply

Your email address will not be published. Required fields are marked *