Recover Uncommitted Changes in IntelliJ IDEA With Local History
IntelliJ IDEA Local History can recover deleted files and overwritten edits before your next Git commit—but it is not a backup. Learn when to use it and when to commit instead.
28 Sept 2026, 21:55 UTC

You deleted a file that was never committed
You are mid-refactor and delete a source file, then realize you still need a class from it. You check git status, but the file was never tracked, so Git has nothing to restore. git checkout cannot help because the change was never committed, and Ctrl+Z is gone after you close and reopen the project.
IntelliJ IDEA Local History records file edits, refactorings, and deletions between explicit version-control commits. It can restore content without rewriting Git history, but it is local, per-user, and bounded by retention settings. Treat it as a safety net for uncommitted work, not as a replacement for committing, pushing, or backups.
Recover a file or change from Local History
This example assumes you are using IntelliJ IDEA Community or Ultimate and the file or its parent directory exists in the Project tool window.
- Right-click the directory where the file lived. If the file itself still exists, you can right-click the file instead.
- Choose
Local History > Show Historyfrom the context menu. - In the Local History dialog, select a revision from the time list. The built-in diff viewer shows that revision against the current file state.
- To restore, right-click the revision and choose
Revert Selection. If you want to inspect first, chooseGet Contentsto copy the text into a new tab without overwriting the working file. - Compile or run tests against the restored content before you commit it.
Replace <YourModule> with your actual module or directory name wherever the UI prompts you. No terminal command is required; this runs in the IDE GUI under normal user permissions.
Risk: Revert Selection overwrites the current working copy. Use Get Contents first if you need to compare or merge manually.
Where history lives and when it disappears
- IntelliJ stores Local History in its local system directory on your machine. The exact path varies by operating system and build; open
Help > Aboutto locate it. - Retention is bounded by settings and available disk space. Old revisions are pruned automatically.
- Large binary files, excluded directories, and files modified outside IntelliJ may have limited or no history.
- Invalidating caches, running cleanup, or reinstalling can remove history.
- History is per-user and not visible to teammates, so it cannot support code review or shared recovery.
Verify before you rely on it
- Open
Help > Aboutand confirm your IntelliJ IDEA build. - Open
Settings > Version Control > Local History(or the equivalent path on your build) to confirm the feature is enabled and review retention options. - Test recovery on a scratch file before treating Local History as part of your incident response.
Make it a safety net, not a strategy
Use Local History to recover from accidental deletions and bad refactors between commits. Still commit early, push regularly, and treat Git remotes plus off-machine backups as your real recovery policy. Verify the retention settings on your installed build before depending on Local History for anything critical.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.