Skip to content
Versora

Manual

Undo

Local file history

8 min read

On this page

Versora's Ctrl+Z only reaches what was done by the app. A lot of loss happens outside it: the editor that saved over a passage you wanted, the file deleted in File Explorer, a git checkout -- . or git restore in the terminal, a formatter that rewrote the project. None of that goes through git as a commit, and git doesn't keep the content.

The local history does. While the repository is open in a tab, the app copies each file with uncommitted changes when it changes on disk. You see each file's versions, compare them with the current file and restore one version, several files or all files to a moment.

The copies live inside the repository's git folder and never leave it: they don't go with the push, don't go into .git/objects and git gc doesn't touch them.

When the app saves a version

  • When the file changes on disk (when you save in the editor, for example). The app waits for the burst of changes to settle (2 seconds without changes, at most 15 seconds of continuous editing) and saves the files that changed.
  • When the repository's tab opens or becomes active, and every 10 minutes (default), a full check picks up what the watcher didn't see, such as the changes made while the tab was in the background. The watcher only follows the active tab.
  • Save now, from the window or the palette.

What goes in and what's left out:

Goes inLeft out
Files with uncommitted changes, staged or unstagedFiles identical to the commit (a branch switch, which changes thousands of files, doesn't create copies)
New files, not tracked yetWhat .gitignore ignores, including build and dependency folders (node_modules, target, dist, build…)
A file's deletion (the deleted version)Files larger than the per-file limit (default: 1 MB)
A file going back to the commit's state (the same as commit version: someone discarded or committed it)

The content is saved with the exact bytes on disk, compressed and without repeating identical contents.

See a file's versions

Where to find it

  • The file's menu (right-click a file in the changes panel or in a commit's list): Local history of this file…. The window opens on that file.
  • Shortcut: Alt+H (pressing it again closes it).
  • Palette (Ctrl+P): "Local history of files" ("Automatic copies of files with uncommitted changes").
  • The Timeline window (Alt+Z) › the Local history tab.

Step by step

  1. Open the local history and leave By file selected.
  2. On the left, the "Files with local history" list, from the most recently changed to the oldest, with the number of versions ("3 versions") and the deleted badge when the file no longer exists on disk. Use Filter files to find it by name, or check Deleted only.
  3. Click the file. The versions show up from newest to oldest, each with the time and the kind: changed, deleted or same as commit.
  4. Click a version to see the diff. Choose the comparison:
    • With the current file: "In red, what the version had; in green, what the file has now."
    • With the previous version: "What changed at this moment."
  5. To bring the version back, click Restore this version… (see "Restore", below). On a deleted version, the button is Delete again….

Caveats and messages

  • "This version is the same as the current file." and "No difference from the previous version.": there's nothing to show in the diff.
  • "Binary file: the content can't be compared as text. Restore it to see."
  • "No versions saved yet. The app copies each file with uncommitted changes when it changes on disk (when you save in your editor) and checks everything when you open the tab and every 10 minutes."
  • "2 files larger than 1.0 MB were left out (hover to see).": the tooltip lists the files and their sizes.

Browse by moment

Each recording round is a moment: all the files saved together have the same time. Browsing by moment helps when several things changed at once (a "replace in all files", a formatter) and you want to take everything back to before.

Step by step

  1. On the local history bar, click By moment.
  2. On the left, "Local history moments", each with the time and the number of files.
  3. Click a moment. The title shows "Moment 26/11 14:32" and the list of files recorded in it, with each one's diff.
  4. Use the moment's buttons:
    • Restore this file… or Restore these 4 files…: that moment's files go back to the version from then;
    • Take all files back to this moment…: all files that have a history go back to how they were at that moment.

Every restore shows the plan first, file by file, and only changes anything after you confirm.

Step by step

  1. Click Restore this version…, Restore these N files… or Take all files back to this moment….
  2. Read the plan. The title says what will be done, such as "Restore app.ts as it was at 26/11 14:32". Each file has its action:
    • goes back: the content is replaced with the one from that moment;
    • is deleted: the file didn't exist at that moment and will be deleted;
    • already the same: nothing changes;
    • the outside Ctrl+Z (.gitignore) badge: the file is ignored by .gitignore now.
  3. Read the notes at the end: "1 file only has versions after that moment and stays as it is.", "1 file didn't exist at that moment and will be deleted." and "Ctrl+Z undoes the restore. The current version also stays in the local history."
  4. Click Restore 2 files (the button turns red if any file is going to be deleted). The indicator shows "Restoring 2 files from local history…" and the notice confirms "Local history restored (written: 2, deleted: 0). Ctrl+Z undoes it."

What Versora does in git

Before restoring, the app records the current version of the files in the local history (so you can also go back through it) and saves the Ctrl+Z backup copy. Then it writes each version's content to disk, or deletes the file. Restoring only touches the files in the working directory: the staging area and the branches don't change.

How to undo

Ctrl+Z undoes the restore ("Restore 2 files from local history"), except for the files .gitignore ignores: git doesn't copy those files, and the plan warns you ("1 file is ignored by .gitignore now: Ctrl+Z won't bring it back (its current version stays in the local history)."). For those, restore the previous version through the local history itself.

Caveats and messages

  • "All files are already as they were at that moment: nothing to restore."
  • "This version is no longer in the local history (it was removed by the cleanup).": the version went past the retention period or the space limit.
  • "2 files couldn't be restored:" followed by the list: the file is locked by another program or has no permission.
  • "Local history is turned off (Preferences › Local history)."

Save now

Runs the repository's full check right away, without waiting for the watcher or the interval.

Where to find it

  • The local history bar: Save now (shows "Saving…" while it runs).
  • Palette: "Save local history now" ("Copy changed files right away, without waiting for the file watcher"). With the history turned off, the command shows up as unavailable.

Step by step

  1. Click Save now, or use the palette.
  2. From the palette, the notice says how many versions exist, for example "Local history updated: 48 versions saved."

Local history preferences

Where to find it

  • Preferences › Local history (the Preferences… button on the local history bar opens it directly).
OptionWhat it doesDefault
Save automatically (On)"Copies each file with uncommitted changes when it changes on disk, in the repository of the open tab."On
Keep for (days)"Versions older than this are deleted." Accepts 1 to 365.7 days
Maximum space per repository (MB)"Past the limit, the oldest versions go away. Storage is compressed." The whole oldest moment goes. Accepts 5 to 10,000.100 MB
Maximum file size (KB)"Larger files are left out (builds, binaries, databases)." Accepts 16 to 102,400.1,024 KB
Full check every (minutes)"Besides the file watcher, checks the whole repository at this interval (0 = only when opening the tab)." Accepts 0 to 1,440.10 minutes
Local history in this repository (On for this repository)Turns it on or off only for the open repository. "Turn it off in very large repositories or ones with sensitive files that aren't in .gitignore."On
Space usedShows the space, the versions, the files and since when, and where the folder is ("In ….git\versora-history").—
Delete the history › Delete local history…"Deletes all saved versions for this repository. Doesn't touch your files or Git." Asks for confirmation: "Delete the local history of meu-projeto?" and Delete. It can't be undone.—

The options at the top apply to all repositories; the ones at the bottom, only to the open repository. On the local history bar, the usage shows up as "3.2 MB of 100 MB · versions: 48 · files: 12", and the tooltip says where the folder is.

What Versora does in git

The versora-history folder lives in the repository's internal git folder (the worktree's, in an additional worktree), with the compressed objects and a log of the versions. The app writes the objects with git itself, pointing it to that folder, and lists the changed files with a git status limited to the paths that changed:

bash
git status --porcelain -- <paths that changed>      # .gitignore is already left out
git hash-object -w --no-filters <file>              # with GIT_OBJECT_DIRECTORY on the history folder

Turning the history off for a repository leaves a marker in that folder. Deleting the repository's folder deletes the history with it.

Caveats and messages

  • "Local history is turned off in the preferences." with the Turn on button, and "Local history is turned off for this repository." with Turn on for this repository: they show up in the window when it's off.
  • "The last automatic copy failed: …": the error message, for example a full disk.
  • The history lives on your computer's disk, with no encryption of its own. In a repository with sensitive files outside .gitignore, turn it off for that repository.

The company can hide or lock the Local history page in Preferences (id timeline) through the preferences.hidden or preferences.locked policy. See Company policy.

See also