How can I delete Intellij's local history for a single file?

Didn't find a way to delete a single file, only the entire local history.

On the main menu, choose File | Invalidate Caches/Restart. The Invalidate Caches message appears informing you that the caches will be invalidated and rebuilt on the next start. Use buttons in the dialog to invalidate caches, restart IntelliJ IDEA or both.

Warning! Cleaning out the system caches, keep in mind that:

  • It results in clearing the local history. To avoid losing data, check in the changes to your version control system before invalidating caches.
  • Causes a complete rebuild of all the projects ever run in the current version of IntelliJ IDEA.

See details here.


I don't know of a way to delete the local history of a single file either, but there is a retention period for the local history.

You can disable it by setting it to 0. When you restart afterwards the history will be empty. You can then restore the retention period if you like.

By default, Local History is configured to store revisions for the last 5 working days (that is, days when the file was modified). Change the retention period of Local History

On the Help menu, click Find Action or press Ctrl+Shift+A.

Find and open the Registry editor.

Modify the value of the localHistory.daysToKeep parameter.

Click Close and restart IntelliJ IDEA for the changes to take effect.

If you want to disable Local History completely, set the retention period to 0.

Alternatively, you can pass the localHistory.daysToKeep parameter as a Java property by configuring JVM options. For example, to set retention to 30 days, add the following line to the JVM options file:

-DlocalHistory.daysToKeep=30

https://www.jetbrains.com/help/idea/local-history.html#retention