# Local history

Go back to an earlier state of a file from the timeline the editor keeps each time you save, and compare the commits that changed it.

Each time you save a file in the code editor, Lyna keeps a copy of it in the **Timeline**. If an edit goes wrong, compare the file with an earlier copy or restore it in one step. No commit is needed.

The Timeline view listing the saved versions of the open file, newest first, with the Git history section below them and the file open in the editor.

## What you can do

- See the saved versions of the open file, newest first.
- Compare any version with the current file.
- Restore a version.
- Find a file you deleted and bring it back.
- Delete a version you do not need with **Delete version**.
- See the commits that changed the open file, and compare any of them with the version before it or with your current file.

## Restore an earlier version

1. ### Open the Timeline

   In **Code** mode, open the file, then choose **Timeline** in the views rail.
2. ### Compare

   Pick a version and choose **Compare with current** to see what changed.
3. ### Restore

   Choose **Restore this version**. The file goes back to that version.

Before a restore, Lyna keeps the current file in the timeline as **Before restore**. If you change your mind, restore that entry.

## Find a deleted file

The **Deleted files** section lists the files you deleted from the project that still have saved versions, the most recent first. Open it to see them, 20 at a time, with **Show more** for the rest.

- Click a file to see its last saved version.
- Choose **Restore** on a row to put the file back in the project with its last saved version, then open it.

## Git history of the file

Below the saved versions, the **Git history** section lists the commits that changed the open file, newest first. Each row shows the commit message, its short id, its author and when it was made.

A commit compared with the version before it: the window title names the commit and its message, and the file's lines show as added.

- The list follows the file across renames, so the commits made under its old name are listed too.
- It shows 30 commits at a time. Choose **Load more** to see older ones.
- Choose **Compare with previous** on a commit to see what that commit changed in the file. In the commit that created the file, every line shows as added.
- Choose **Compare with current file** to see how your file differs from that commit.
- A new commit appears in the list as soon as you make it.

The compare window is read only. Press Escape to close it; the keyboard goes back to the button you used.

## What the timeline keeps

- A version for each save, marked **Saved**.
- A **Before restore** version each time you restore.
- Up to 50 versions per file, for up to 30 days. The oldest versions are removed first.

> [!WARNING]
>
> **Stored in this browser**
>
> The saved versions are kept in your browser, for each project and branch. Signing out removes them from this browser. They are not shared with your team and do not follow you to another computer. The **Git history** section reads the project's commits, which everyone on the project shares. To add to that history, commit your work with [Git](/features/code/git), or use [Version history](/features/projects/version-history) for the whole project.

## Related

- [Version history](/features/projects/version-history): Restore the whole project to an earlier version.
- [Git](/features/code/git): Commit, branch and stash.
- [Code editor](/features/code/code-editor): Tabs, split views and language tools.
