Skip to content
Versora

Manual

Inspection

Blame

10 min read

On this page

For each line of a file, blame shows the commit that last wrote it: author, date and message. It helps you understand why a line is the way it is, find who can explain a piece of code, and discover which commit changed a behavior.

Versora groups consecutive lines from the same commit into a block. The annotation column is on the left and the code is on the right, with syntax highlighting. Each person has their own color on the block's border, and the lines you changed and haven't committed yet show up as Not committed yet.

Open blame

Where to find it

  • Diff header: Blame button (tooltip: "Who changed each line of this file, and in which commit").
  • File menu (right-click a file in the changes panel or in a commit's file list): File blame.
  • File history: right-click a version › Blame this version.
  • Revision tree: Blame button in the file header, or right-click a line › Blame this version.
  • Revision comparison, Files tab: right-click a file › Blame at <revision>.
  • Windows File Explorer: right-click the file › Versora › Blame. See File Explorer.
  • Command line: versora blame file[:line]. See Command line.

Which version of the file is shown

Where you opened it fromAnnotated versionWhat the title shows
Diff or menu of a changed file (unstaged or staged)The file as it is on disk, with the lines not committed yetworking directory chip
A commit's file listThe file in that commitat a1b2c3d chip
File deleted in the commitThe version from before the commit (the parent)Chip with the parent's SHA
File history, tree or comparisonThe version chosen thereChip with the version

Step by step

  1. Open the file's diff and click Blame.
  2. Hover over a block to see the commit card: summary, author, date, co-authors and Signed-off-by. If the file had another name in that commit, the card shows "file at the time: <path>".
  3. Click the block to select the commit in the graph and see its details in the right panel.
  4. Right-click the block for the other actions (table below).
  5. To close, use the X in the header or Esc.

A block's menu

ItemWhat it does
Go to commit in graphCloses blame and selects the commit in the graph. On a "Not committed yet" block, it becomes Go to local changes.
Copy SHACopies the commit's full SHA.
Blame before this commitOpens the blame of the previous version of the file, the one in the commit's parent. Shows who wrote the line before that change. On a "Not committed yet" block, it becomes Blame the committed version (HEAD). It's disabled on the commit that created the file.
File history up to this commitOpens the file history up to that commit.
History of this range (lines X–Y) or History of this line (N)Opens the line history of the whole block.
Open linkSubmenu with the links in the commit message (issues, MRs, Jira, addresses). It only appears if the message has any. See Links in messages.
Investigate the origin of line N…Follows the line under the pointer through the history back to where it was born. See Line origin.
Browse the tree of this versionOpens the revision tree of that commit, already on the file.
Copy Versora link to line N or to lines X–YCopies a versora:// link that opens this file in blame, with the lines marked. If you picked lines inside the block, the link carries only those. See versora:// links.

What Versora does in git

Blame only reads the repository. The equivalent command is:

bash
git blame --porcelain [-w] [--no-ignore-revs-file --ignore-revs-file <list>] [<commit>] -- <file>

Without <commit>, git annotates the file on disk. With it, git annotates the version in that commit.

How to undo

There's nothing to undo: blame doesn't change anything in the repository or in your files.

Caveats and messages

  • "The file "<file>" isn't in Git yet (untracked); there's no authorship to show.": the file was never committed or staged. That's why the File blame item is disabled on untracked files. A new file that's already staged is annotated, with every line as "Not committed yet".
  • "Binary file: blame only works on text files." and, on the diff button, "Blame only applies to text files.": images and other binaries have no lines to annotate.
  • "File too large for blame (<size>; the limit is <limit>).": the limit is 8 MB.
  • "The file "<file>" doesn't exist in this version (<sha>).": the requested version doesn't have the file, for example a commit from before it was created.
  • "The file is empty in this version.": there are no lines to annotate.
  • "Computing blame…" with "Large files or files with a long history can take a few seconds.": git is still working. The reload button ("Recompute blame") asks for the computation again.

See also

Colors by age (Age)

With Age on, each block gets the color of the commit's age: orange for recent code, gray in the middle and blue for old code. This way you see at a glance what changed recently and what nobody has touched in years. With Age off, the blocks only have alternating stripes.

Where to find it

  • Blame bar: Age button (tooltip: "Color the blocks by commit age: the more recent, the brighter").
  • With Age on, the Scale button appears next to it, with a color strip (tooltip: "Age color scale and how many lines of the file fall in each band").

Step by step

  1. Turn on Age in the blame bar. It comes on by default, and your choice is remembered.
  2. Click Scale to open the Age scale legend.
  3. Choose the scale:
    • By date: "Fixed time bands counted from today: the same color means the same age in any file."
    • Relative to the file: "Each commit's position among this file's commits: the order of changes, even in an old file."
  4. For each band, the legend shows how many lines of the file fall in it, with a proportional bar.
  5. Close the legend with Esc or by clicking outside it.
OptionWhat it doesDefault
AgeTurns the colors by age on or off.On
By dateSeven bands: Up to 1 week, Up to 1 month, Up to 3 months, Up to 1 year, Up to 2 years, Up to 4 years and Over 4 years.Selected
Relative to the fileSeven bands by the order of the file's commits: Newest, Band 2 to Band 6 and Oldest.—

The colors come from the theme in use and work in the light, dark and high contrast themes.

The ‹ and › arrows in the blame bar take you to the previous or next version of the file, without leaving the screen. The picker between them lists every version, and navigation follows renames. This helps you see how a piece of code evolved, version by version.

Where to find it

Blame bar, to the left of the option buttons:

  • ‹ ("Previous revision"): the tooltip says which commit it goes to, with SHA, date, author and summary.
  • File version picker: each item has the position (for example 3/27), the SHA, the date, the author and the summary. When blame started from disk, the first item is Working directory (local changes).
  • › ("Next revision"): goes forward, at most up to the version blame started from.

Step by step

  1. Open the blame of a file.
  2. Click ‹ to see the blame of the previous version. The picker's tooltip shows where you are, for example "Version 3 of 27".
  3. Click › to go one version forward, or choose any version in the picker.
  4. From the working directory, ‹ goes to the HEAD version. If the file has no local changes, it goes straight to the one before it, which is the first one that's different.

Caveats and messages

  • "This is the first version of the file": there's no older version.
  • "This is the newest version since the blame started": › doesn't go past the starting point.
  • "Outside the file's main line": the version shown isn't in the history the picker follows, for example a commit from another branch.
  • "Version N of M+": the file has more versions than the ones read so far. Versora reads the history a little at a time, up to 2,000 versions.
  • "Couldn't read the file history": the picker becomes unavailable, but blame keeps working.

Back and Forward

After Blame before this commit or a version change, the header gets the ← Back button ("Go back to the version you were on before choosing "Blame before this commit""). After you go back, Forward appears ("Goes back to the version you came back from"), which retraces the path. The two work like a browser's back and forward, only inside blame.

Ignore whitespace

Ignore whitespace ("Don't attribute lines to commits that only changed whitespace (git blame -w): useful to see past reindentations") makes git skip over commits that only touched whitespace and indentation. Authorship goes back to whoever wrote the content of the line.

  • It comes off by default.
  • Once you turn it on, it applies to the next blames until you close Versora.
  • It's equivalent to git blame -w.

Ignore revisions (.git-blame-ignore-revs)

Formatting-only commits, such as reindenting the whole project or changing quotes, "steal" the authorship of many lines. The convention to avoid this is to list those commits in a .git-blame-ignore-revs file at the root of the repository, one full SHA per line (# starts a comment). Git also accepts a list in the blame.ignoreRevsFile setting.

When the repository has this list, Versora already ignores those commits in blame, and the bar shows the Ignore revisions (N) button, with N equal to the number of commits in the list.

Where to find it

Blame bar: Ignore revisions (N). The button only appears when the list exists in the .git-blame-ignore-revs file or in blame.ignoreRevsFile.

Step by step

  1. Open the blame of a file in a repository that has .git-blame-ignore-revs.
  2. With the button on, the lines a commit in the list changed go back to whoever wrote them before. The tooltip says how many commits are being ignored and where the list came from.
  3. Click the button to turn it off and see the real authorship, including that of the formatting commits. The choice is saved per repository.

Example of .git-blame-ignore-revs

# General reindentation with the formatter (March)
3f1c2a9d4b5e6f708192a3b4c5d6e7f8091a2b3c
# Switch from single to double quotes
9a8b7c6d5e4f30211f2e3d4c5b6a79881726354a
OptionWhat it doesDefault
Ignore revisions (N)Turns the list on or off in this repository's blame.On, when there's a list

What Versora does in git

Git aborts the whole blame if the list has a line that isn't a hash. That's why Versora reads both lists, keeps only the full hashes (SHA-1 or SHA-256) and hands git a clean list, in a temporary file:

bash
git blame --porcelain --no-ignore-revs-file --ignore-revs-file <clean-list> -- <file>

Caveats and messages

  • "N lines in the list aren't a full SHA and were skipped.": appears in the button's tooltip. Abbreviated SHAs don't count; use the full SHA.

Wrap lines

Wrap lines ("Wrap long code lines in blame") makes long lines continue on the line below, instead of requiring horizontal scrolling. It comes off by default and your choice is remembered. The same setting is in Preferences › Navigation and appearance › Wrap lines › In blame.

Pick lines in blame

Click a line number to pick it ("Click to pick the line (Shift+click: up to here) and see the history of the range"). Shift+click another line number to pick the range. Clicking the same line again releases the selection.

With lines picked, a strip appears below the bar with "line N" or "lines X–Y" and the buttons:

  • Line history: opens the line history (git log -L).
  • Clear: releases the selection.

Co-authors and owners in blame

  • When a block's commit has co-authors (Co-authored-by trailer), +N appears next to the author, with the tooltip "With <names>". The block's card lists the co-authors and the Signed-off-by as people. See Links in messages.
  • If the repository has CODEOWNERS, the blame title shows the file's owners. See CODEOWNERS.
  • The encoding button in the bar shows how the file was read and lets you choose another encoding. See Legacy encodings.
  • Preferences › Navigation and appearance: Wrap lines › In blame and the Code font used in blame. See Navigation and appearance.
  • Preferences › Encodings: the repository's default encoding.
  • The company policy can hide Preferences pages or make them read-only (preferences_hidden and preferences_locked). Blame itself has no policy key. See Policy keys.

See also