IntelliJ local history: get back code you never committed
An agent or a bad edit just wiped code you never committed in IntelliJ.
IntelliJ keeps its own copy, called Local History. Right-click anywhere in the editor and choose Local History | Show History. The left pane lists saved revisions of the file with timestamps, and the right pane shows a diff against the current file.
To roll the whole file back, right-click a revision and choose Revert Selected and Later Changes. By default, revisions are kept for the last 5 working days (days when the file was modified), and JetBrains says Local History is cleared when you install a new version of the IDE.
Lost code you saw but can't find? Download ReMynd
Is Local History the same as Git?
No. As of December 2026, JetBrains' Local History docs say Local History helps you constantly track all changes made to a project independently of version control. It automatically records your project's state as you edit code, run tests, deploy applications, and so on. The page is the IntelliJ IDEA 2026.3 help, dated August 17, 2026, and this post reflects it as checked on December 4, 2026.
That's why it can save you when Git can't. JetBrains says it lets you roll back to any state of a file even if no version control is enabled for your project yet, or if an unwanted change was made after your last commit.
The same docs are clear it isn't a backup. Local History is not a replacement for proper version control for long-term versioning.
So ask how long ago you last saw the good version. In our view, if that's inside the retention window, Local History probably has it.

Where to open Show History for each case, from JetBrains' IntelliJ IDEA docs. Working days are days when the file was modified. Illustration by ReMynd.
The 3 ways to get code back
Local History restores code in three ways, and each one starts from Local History | Show History.
- One file. In Show History, right-click a revision and choose Revert Selected and Later Changes. To keep your other edits, select the revision that contains the fragment and click the chevron button in the diff to copy it from the left pane.
- A folder or the whole project. In the Project tool window (Alt+1), right-click the node or the files and select Local History | Show History. Find the change, revert it, or open it in the diff viewer and use the chevron button.
- A deleted file. For an intellij restore deleted file job, open Show History on the node that contained it, select the revision that contains the file, right-click that file and select Revert Selection.
Can't find the revision? JetBrains says you can type a piece of file content in the search bar of the Local History dialog.
A simple decision path
Restoring lost code takes five steps, and you can stop at the first one that gets it back.
- Check the window. If the change is older than your retention period, skip to Git or your agent's own undo.
- Open Show History. Use the editor for one file, the Project tool window for a folder or a deleted file.
- Search by content. Type a line you remember into the dialog's search bar.
- Diff before you revert. In our view, copy back one fragment with the chevron when you only lost part of a file, since a full revert also rolls back later changes.
- Label before risky work. Select File | Local History | Put Label before a refactor or before you let an agent loose.
What Local History keeps, and for how long
| Question | What JetBrains' docs say |
|---|---|
| How long are revisions kept? | By default, the last 5 working days (that is, days when the file was modified) |
| Where do I change it? | Advanced Settings, Duration of storing changes in Local History field, or a line such as -DlocalHistory.daysToKeep=30 in the JVM options file |
| Can I turn it off? | Set the retention period to 0 |
| Where is it stored? | Binary files under the LocalHistory subdirectory in the IntelliJ IDEA system directory |
| macOS folder | ~/Library/Caches/JetBrains/<product><version> |
| Windows folder | %LOCALAPPDATA%\JetBrains\<product><version> |
| Linux folder | ~/.cache/JetBrains/<product><version> |
| Can I share it? | Not directly. It is stored locally and intended only for personal use, but Create Patch makes a patch file relative to a revision |
The intellij local history location moves with the system directory. JetBrains' directories page says the IntelliJ IDEA system directory contains caches and local history files, and you can change it using the idea.system.path property. The JVM options file is covered on JetBrains' tuning the IDE page.
For jetbrains local history in other IDEs, check that IDE's own help page. The PyCharm Local History page gives the same 5 working day default and says Local History is cleared when you install a new version of PyCharm. That page is the PyCharm 2026.3 help, also dated August 17, 2026. For android studio local history, this page doesn't quote Google's docs, so check Android Studio's own docs for menu names.
When Local History won't help
If your intellij local history is missing, check these first.
- You upgraded the IDE. JetBrains says Local History is cleared when you install a new version of IntelliJ IDEA.
- It's past the window. It has a retention period and maximum size, so revisions are not guaranteed to persist.
- Retention is set to 0. That disables Local History completely.
If an AI agent made the change, check its own undo first. Cursor has checkpoints, Claude Code has /rewind, and the Codex story is in Codex undo changes. See Cursor restore checkpoint and Claude Code rewind. If you lost a stash rather than an edit, git stash lost covers finding it. On VS Code, the same idea lives in the Timeline view, covered in VS Code local history.
Where ReMynd fits
ReMynd is a desktop app that gives your computer local photographic memory, for you and your AI agents. It locally captures your screen history and keeps the searchable index on your computer.
So if code was on your screen in the window you were working in, starting from install, you can search for a word from it, even after Local History has rolled past it. It doesn't restore files and doesn't read your IntelliJ data.
On a Mac, ReMynd needs screen recording permission, which Apple's guide puts in System Settings under Privacy & Security, Screen & System Audio Recording. There's more for engineering teams on ReMynd for engineers.
Your screen history is stored on your computer by default, and nothing is uploaded to us unless you turn on optional cloud sync. You can pause capture, and block apps or URLs. That's how ReMynd's own pages put it.
Honest limits
- ReMynd can't restore a file or an IntelliJ Local History revision.
- ReMynd captures only what is on your screen, starting from install. It can't recover code you saw before that.
- Text recognition reads the window you're working in, so code in a window behind it won't be searchable by its words.
- This page quotes JetBrains' IntelliJ IDEA and PyCharm docs only. Menu names in other JetBrains IDEs or in Android Studio can differ.
- On a Mac, ReMynd needs Apple silicon and macOS 15 or later. ReMynd also runs on Windows 11 (x64 or arm64).
The short version
Right-click in the editor, choose Local History | Show History, and revert the revision you want, or copy back just the fragment. For a deleted file, open Show History on its parent folder and use Revert Selection. Revisions last 5 working days (days the file changed) by default and are cleared when you install a new IDE version. For the wider problem of agents losing your work, giving an AI coding agent memory of your actual work is the next read.
Want the code you read to stay findable? Download ReMynd