Skip to content
Versora

Manual

Inspection

File history

5 min read

On this page

File history lists, from newest to oldest, every commit that touched a file. It follows renames: if src/pedido.ts used to be called src/order.ts, the commits under the old name show up too. When you choose a commit from the list, you see the message and the file's diff in that commit.

Use the history to understand how a file reached its current state, find the commit that brought a change, or recover the content of an old version.

Open the history

Where to find it

  • Diff header: History button (tooltip: "Commits that changed this file, following renames").
  • File menu (right-click a file in the changes panel or in a commit's list): File history.
  • Blame bar: History button ("This file's history").
  • A blame block's menu: File history up to this commit.
  • Revision tree: File history button ("Commits that changed this file up to this revision").
  • Revision comparison, Files tab: right-click a file › File history.
  • Treemap: right-click a file › History.
  • Windows File Explorer: Versora › File history. See File Explorer.
  • Command line: versora log [path]. See Command line.

Where the history starts from

  • From a file changed on disk or in staging: the history starts from HEAD, and the title shows the from HEAD chip.
  • From a commit (a commit's file list, the blame of a version, the tree): the history goes up to that commit, which is already selected. The header gets a picker with two options:
OptionWhat it shows
Up to <sha>"Only commits up to the one the history was opened from"
From HEAD"The file's whole history on the current branch, including newer commits (follows the file's current name if it was renamed later)"

Step by step

  1. Open the file's diff and click History.
  2. Go through the list with the mouse or with ↑ and ↓. Each row shows the summary, the author, the date (the full date is in the tooltip), the short SHA and, when the commit isn't a simple modification, a badge such as Added, Deleted or Renamed.
  3. On a rename, the row shows "renamed from <path>". On a commit where the file had another name, it shows "name at the time: <path>".
  4. On the right, see the message (with links), the author, the date and the file's diff in that commit.
  5. Scroll to the end of the list to load more. Versora reads 100 commits at a time and shows "Loading more commits…" while it fetches. The counter becomes "N+ commits" when there are more.
  6. Close with the X in the header or Esc.

A version's menu

Right-click a commit in the list:

ItemWhat it does
Go to commit in graphCloses the history and selects the commit in the graph.
Copy SHACopies the full SHA.
Blame this versionOpens the blame of the file as it was in that commit. It's disabled on the commit that deleted the file and on images.
Restore file from this version…Brings the content of that version into the working directory (see below).

The same Go to commit in graph, Copy SHA and Restore file from this version… buttons are also in the chosen commit's header, on the right.

What Versora does in git

The history only reads the repository:

bash
git log --follow -M --name-status -z --format=<fields> -n <count> <starting-commit> -- <file>

--follow only follows renames backward. For the From HEAD option on a file seen in an old commit, Versora first finds the file's current name with git diff -M --name-status --diff-filter=RD <commit> HEAD.

Caveats and messages

  • "No commit up to <sha> changed this file." or "No commit on the current branch changed this file.", with "This happens with new files that haven't been committed yet, or that don't exist in that version.": there's no history to show.
  • "The file isn't in Git yet (untracked).": appears on the disabled diff button of a new file. Make its first commit to have a history.
  • "(no message)": the commit was recorded without a message.
  • "This commit isn't among those shown in the graph (its branch is hidden by the filter or it's beyond the loaded commit limit). Its details are in the right panel.": appears after Go to commit in graph when the graph doesn't show that commit. Show the branch in the filter or increase Commits loaded in the graph in Preferences › General.

Restore file from this version

Brings into the working directory the content the file had in a commit from the history. It's useful, for example, to undo an old change to a single file without touching the rest of the project.

Where to find it

  • File history: Restore file from this version… button in the chosen commit's header (tooltip: "Brings the content the file had in this commit into the working directory (asks for confirmation)").
  • File history: right-click a version › Restore file from this version….

Step by step

  1. In the history, choose the version you want to bring back.
  2. Click Restore file from this version….
  3. Read the Restore file from this version confirmation: "Bring back "<file>" as it was in <sha> (<summary>)? The file's current changes will be replaced and the result will be staged — you can undo it right afterward (Ctrl+Z)."
  4. Click Restore file. While it runs, "Restoring file…" appears. At the end, the notice "Restored <file> from <sha>".
  5. Check the result in the changes panel: the restored file is already staged.

What Versora does in git

bash
git checkout <sha> -- <file>

The file changes on disk and in staging. Branches and the other files don't change.

How to undo

Ctrl+Z undoes the Restore file and puts the file back as it was, including the uncommitted changes it had. See Undo and redo.

Caveats and messages

  • "This commit deleted the file: there's no content to restore. Use the previous version.": the button is disabled on the commit that deleted the file. Choose the commit right below it.
  • "Note: in this version the file was named "<old name>" — it will be recreated with that name, and "<current name>" won't be changed.": in a version from before a rename, the file comes back with the name it had at the time, next to the current one.
  • "If the file no longer exists under this name (it was renamed or deleted later), it will be recreated.": a notice that appears in the confirmation.

Tip

To bring a file from a branch or a tag, without going through the history, and choose whether or not it goes to staging, use Bring a file from another branch or commit.

File history has no preference of its own, and no company policy key affects it.

See also