← all articles

VS Code local history: restore a file version you never committed

An agent or a bad edit just overwrote a file you never committed.

VS Code keeps its own copy, called local history. Open the Timeline view at the bottom of the File Explorer, pick the file, and look for local file events. VS Code's docs say that, depending on your settings, every time you save an editor, a new entry is added, and each entry contains the full contents of the file at the time the entry was created. From an entry you can compare the changes and restore the contents.

For a deleted file, use ... > Local History: Find Entry to Restore in the Timeline view.

Lost code you saw but can't find? Download ReMynd

Is local history the same as Git?

No. Local history is a separate source that sits next to Git in the Timeline view.

Microsoft's VS Code user interface docs describe the Timeline view as a unified view for visualizing the events history for a file. For example, you can view Git commits or local file saves in a timeline view. This page reflects those docs as checked on December 3, 2026.

Local history arrived in March 2022, in the version 1.66 release notes, which say local history of files is now available in the Timeline view.

Saves you never committed still show up there, depending on your settings. That's what the vs code timeline local history filter shows.

Diagram titled VS Code local history: A copy on every save. Depending on your settings. Entries sit in the Timeline view. Left card, highlighted in claret, Timeline, local file events: compare with the file or previous entry; restore the contents; delete or rename the entry. Right card, Settings that set limits: maxFileSize, default 256 KB; maxFileEntries, default 50 per file; mergeWindow, default 10s. Bottom bar: Deleted file? ... > Local History: Find Entry to Restore.

Local history entries sit in the Timeline view next to Git commits. Illustration by ReMynd.

A simple decision path

Restoring an older version takes four steps in the Timeline view, and you can stop at the first one that gets the file back.

  1. Open the file. Then open the Timeline view at the bottom of the File Explorer.
  2. Filter to local events. A filter action in the Timeline view toolbar enables you to filter between source control events and local file events.
  3. Pick an entry. Compare the changes to the local file or previous entry.
  4. Restore it. Choose Restore the contents on the entry you want.

In our view, compare first, so you know what an entry holds before you restore its contents.

How to restore a deleted file

To vscode restore deleted file contents, Microsoft's docs give a tip: if you've accidentally deleted a file, you can restore it from the local history by using the ... > Local History: Find Entry to Restore action in the Timeline view, and then select your file from the Quick Pick.

Microsoft's release notes also list a global command, workbench.action.localHistory.restoreViaPicker, to find a history entry to restore across all files. The release notes say the new local history commands don't have default keybindings, but you can add your own keyboard shortcuts.

The settings that decide what's kept

VS Code's docs list these settings for working with the local history.

SettingWhat Microsoft's docs sayDefault
workbench.localHistory.enabledEnable or disable local historytrue
workbench.localHistory.maxFileSizeFile size limit when creating a local history entry256 KB
workbench.localHistory.maxFileEntriesLocal history entries limit per file50
workbench.localHistory.excludeGlob patterns for excluding certain files from local historynot stated
workbench.localHistory.mergeWindowInterval in seconds during which further changes are added to the last entry in local file history10s

In our view, the two to check first are maxFileEntries and mergeWindow. A busy file can roll past its entry limit, and quick saves inside the merge window land in one entry.

Microsoft's release notes also say where entries live. When opening local files, the entries are persisted in the local user data folder, and when opening remote files, they will be stored on the remote user data folder. When no file system is available (for example, in certain cases when using VS Code for Web), entries are stored into IndexedDB.

When local history won't help

If the vs code timeline not showing local entries is your problem, check these cases first.

  • You never saved. Entries are added on save, depending on your settings.
  • The file is too big. Anything over maxFileSize gets no entry.
  • It's excluded. A glob in workbench.localHistory.exclude skips it.
  • You turned it off. workbench.localHistory.enabled is false.

If an AI agent made the change, Cursor has checkpoints and Claude Code has /rewind, but Codex CLI no longer has an /undo command. See Cursor restore checkpoint, Claude Code rewind, and Codex undo changes. In our view, local history is the fallback when those fail, as long as the file was saved in VS Code.

Working in a JetBrains IDE instead? IntelliJ local history covers Show History and its default of 5 working days (days when the file was modified).

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 if no version of the file survived. It doesn't restore files and doesn't read your VS Code data.

On a Mac, ReMynd needs screen recording permission, which Apple's guide puts in System Settings under Privacy & Security, Screen & System Audio Recording. For more on agents losing work, read recover a Claude Code session after a crash. 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 or block any app or site. That's how ReMynd's own pages put it.

Honest limits

  • ReMynd can't restore a file or a VS Code local history entry.
  • 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.
  • On a Mac, ReMynd needs Apple silicon and macOS 15 or later. ReMynd also runs on Windows 11 (x64 or arm64).

The short version

Open the Timeline view, filter to local file events, and restore the entry you want. For a deleted file, use local history find entry to restore, listed as ... > Local History: Find Entry to Restore. Entries are added on save, depending on your settings, and maxFileEntries sets the limit per file. 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

common questions

Does VS Code have local history? +
Yes. Microsoft's VS Code docs say that, depending on your settings, every time you save an editor, a new entry is added to the list in the Timeline view. Each entry contains the full contents of the file at the time the entry was created.
Where is local history in VS Code? +
In the Timeline view, which VS Code's docs place at the bottom of the File Explorer. A filter action in the Timeline view toolbar switches between source control events and local file events.
How do I restore a deleted file in VS Code? +
VS Code's docs say you can restore it from the local history by using the ... > Local History: Find Entry to Restore action in the Timeline view, and then select your file from the Quick Pick.
How many versions does VS Code keep? +
The setting workbench.localHistory.maxFileEntries sets the local history entries limit per file, with a default of 50. Files over workbench.localHistory.maxFileSize (default 256 KB) are a separate limit.
Does local history work without Git? +
Local history is a separate source from Git in the Timeline view. VS Code's docs describe it as local file saves, next to Git commits.
Can ReMynd restore a file in VS Code? +
No. ReMynd doesn't restore files. If the code was on your screen in the window you were working in, starting from install, you can search ReMynd for a word from it.