Skip to content
Versora

Manual

Changes

Reading the diff

16 min read

On this page

The diff shows what changed in a file: the removed lines in red, with −, and the added ones in green, with +, with a few unchanged lines around them for context. In Versora, the same viewer is used for local changes (unstaged, staged, new file), for the files of a commit and for comparisons.

This page explains how to open and read the diff and each option on the bar. Staging from the diff is in Staging; discarding, in Discarding changes.

Open, close and read the diff

Where to find it

  • Local changes: click a file in the changes panel.
  • A commit's file: select the commit in the graph and click the file in the right panel's list.
  • Comparisons: the comparison of a commit with the working directory and the diff between two commits use the same viewer (see Comparing).
  • The diff opens in the central area, in place of the graph.

Step by step

  1. Click the file. The diff opens and the file's row stays marked in the list.
  2. Read it from top to bottom, or use the bar's Previous change and Next change arrows to jump from block to block.
  3. To close it: click the same file again, press Esc with the focus on the diff, or click the X ("Close (Esc)").

The header

PartWhat it shows or does
Folder and nameThe file's path (the tooltip shows the full path).
ModeWhere the diff comes from (table below).
+12 −3How many lines were added and removed. It doesn't appear in an image diff.
OwnersThe file's owner according to CODEOWNERS, when the repository has one (see Checks).
Blame / HistoryOpen the blame and the file history. On a new file they're disabled ("The file isn't in Git yet (untracked)."); Blame is too, on a binary or an image ("Blame only applies to text files.").
Stage file / Unstage fileOnly on local changes (see Staging).
External tool icon"Open in external diff tool" (see git mergetool and git difftool). Disabled on a new file: "New file: there's no previous version to compare with".
X"Close (Esc)".

The diff modes

The text next to the name says what's being compared:

ModeWhat it comparesEquivalent command
unstagedThe stage with the file on disk: what you changed and haven't staged yet.git diff -- file
stagedHEAD with the stage: what goes into the next commit.git diff --cached -M -- file
new fileNothing with the file on disk: a file git doesn't track yet.git diff --no-index -- /dev/null file
in commitThe commit with its first parent (on the repository's first commit, with nothing).git diff -M <parent> <commit> -- file
commit × working directoryA commit with the file on disk.git diff -M <commit> -- file
between two commitsAny two commits, for example from the multiple selection in the graph.git diff -M <from> <to> -- file

The -M makes git recognize renamed files.

Colors and highlighting

  • Green background and +: added line. Red background and −: removed line. No color: context.
  • Syntax highlighting by the file extension (TypeScript, Rust, C#, YAML, SQL and many others).
  • Changed part within the line: when a removed line is followed by its new version, the part that changed is highlighted in both. If almost the whole line changed, there's no extra highlight.
  • Line numbers on the left: the old version's and the new one's.

What Versora does in git

Only reads: the diff is requested from git according to the mode (table above), with the chosen number of context lines (-U) and, with Ignore whitespace, the -w option. Nothing changes in the repository.

Caveats and messages

  • "Binary file — the content can't be displayed.": git doesn't show a text diff for it. Images are the exception: see "Image diff" below.
  • "No content differences (e.g. only a mode change, a rename or an empty file).": the file changed, but not in its text.
  • A submodule or a Git LFS pointer appears as a summary, instead of the text diff (see Submodules and Git LFS).
  • Very large diffs are cut at around 2 MB of text; the end of the file doesn't appear. To see it whole, use the external diff tool.
  • Very large blocks (hundreds of thousands of characters) appear without syntax highlighting, so the screen doesn't freeze.
  • With strange characters in place of accented letters, the file is probably in another encoding: see Legacy encodings.

See also

Unified and Split

These are the two ways of drawing the diff. Unified interleaves the old and new lines in a single column; Split puts the old version on the left and the new one on the right, with the lines aligned.

Where to find it

  • On the diff bar, on the right: Unified | Split. The tooltips say "Old and new interleaved" and "Old on the left, new on the right".

Step by step

  1. Open a file's diff.
  2. Click Split. The removed lines are on the left and the added ones on the right, paired by position; the context appears on both sides.
  3. To go back, click Unified.
OptionWhat it doesDefault
UnifiedOne column, with old and new lines interleaved.On
SplitTwo columns: old on the left, new on the right.Off

Caveats and messages

  • In split mode, each side has its own line numbers. To choose lines to stage or discard, click the numbers on the left (removed lines) or on the right (added lines).
  • Narrow screens work better in unified mode, or in split mode with Wrap lines.

The choice is remembered between sessions and applies to all diffs.

See also

Whole file or only the hunks

By default the diff shows only the hunks: the changed blocks with a bit of context. The File view shows the whole file, with the changes highlighted where they are.

Where to find it

  • On the diff bar, in the center: File | Diff. The tooltips: "Shows the whole file, with the changes highlighted" and "Shows only the changed hunks".
  • The picker doesn't appear on a new file (which is already shown whole), on an image and in the Markdown preview.

Step by step

  1. Open the diff and click File.
  2. Scroll normally, or use the Previous change / Next change arrows and the ruler on the right to go to each block.
  3. Click Diff to go back to the hunks.
OptionWhat it doesDefault
DiffOnly the hunks, with the chosen context lines.On
FileThe whole file.Off

What Versora does in git

In the File view, the diff is requested with a huge context (-U1000000), which brings the whole file as a single hunk.

Caveats and messages

  • In the File view, the hunk headers don't have the Stage hunk, Discard hunk and Stash buttons, because the whole file becomes a single hunk. To stage part of the file in this view, choose the lines (see Staging).
  • The context lines control disappears in the File view: it would have no effect.

See also

Context lines

Context lines are the unchanged lines shown around each hunk. More context helps you understand where the change is; less context makes the diff short and splits nearby changes into smaller hunks, which you can stage or discard one by one.

Where to find it

  • On the diff bar, on the right: − 3 +. The − ("Less context around the changes") decreases it, the + ("More context around the changes") increases it, and clicking the number goes back to git's default.
  • Preferences › Navigation and appearance › Diff, blame and conflicts › Diff context lines.

Step by step

  1. Open the diff in the Diff view.
  2. Click the + a few times: 3, 5, 8, 10… The diff is read again with the new context.
  3. Click the number to go back to 3.
OptionWhat it doesDefault
Accepted values1, 2, 3, 5, 8, 10, 15, 25 and 50 lines. The − stops at 1 and the + at 50.3 lines ("3 lines (git default)" in Preferences)
Clicking the numberGoes back to git's default. The tooltip reminds you: for the whole file, use File.—

What Versora does in git

bash
git diff -U8 -- src/login.ts

With the default value (3), the app doesn't pass -U and git's own default applies.

Caveats and messages

  • The control doesn't appear on a new file or in the File view.
  • With more context, neighboring hunks can merge into one; with less, a large hunk can split. The stage and discard buttons act on the hunk as it appears on screen.

The choice applies to all diffs and is remembered. The same preference is in Preferences › Navigation and appearance (Navigation and appearance).

For IT

The Navigation and appearance page of Preferences can be hidden or locked by the company policy (preferences.hidden / preferences.locked, id ergo-view). When locked, it shows "This page is set by your company and is read-only."; the diff's own − 3 + control stays on the bar. See Company policy.

See also

Ignore whitespace

Turns on git diff -w: the diff hides the differences that are only whitespace (indentation, trailing spaces, tabs instead of spaces). It's for reading a change that came mixed with a reindentation.

Where to find it

  • On the diff bar, on the right: Ignore whitespace. The tooltip: "Hides differences that are only whitespace (git diff -w). While it's on, staging and discarding by hunk or by line are disabled: the diff without the whitespace can't be safely applied back."

Step by step

  1. Open the diff of a reindented file.
  2. Click Ignore whitespace (the button becomes checked). The diff is read again without the spacing changes.
  3. Read what really changed.
  4. Click it again to turn it off before staging or discarding parts of the file.
OptionWhat it doesDefault
Ignore whitespaceAsks git for the diff with -w.Off

What Versora does in git

bash
git diff -w -- src/login.ts

Caveats and messages

  • While it's on, you can't stage or discard parts of the file: the hunk buttons are disabled ("Unavailable while "Ignore whitespace" is on: the diff without the whitespace doesn't match the real file and can't be safely applied back.") and the lines can't be chosen. Stage file for the whole file still works.
  • The choice is remembered for the next diffs. If the hunk buttons are grayed out for no apparent reason, check whether Ignore whitespace is on.
  • "No differences other than whitespace. Turn off "Ignore whitespace" to see the spacing changes.": the file only changed in whitespace.
  • On a new file the button is disabled: "No effect on a new file: there's no previous version to compare with".
  • Blame has its own Ignore whitespace (git blame -w): see Blame.

The choice is remembered between sessions and applies to all diffs.

See also

Wrap lines

Long lines continue on the next line instead of requiring horizontal scrolling. Useful for text, Markdown, minified JSON and log lines.

Where to find it

  • On the diff bar, on the right: Wrap lines ("Wrap long lines").
  • Blame and the conflict editor have their own Wrap lines button (see Blame and The conflict editor); in the conflict editor, the three panes stay aligned.
  • Preferences › Navigation and appearance › Diff, blame and conflicts › Wrap lines, with the In blame and In the conflict editor options.

Step by step

  1. Open the diff of a file with long lines.
  2. Click Wrap lines. Each long line takes up several lines on screen, with a single number.
  3. Click it again to turn it off.
OptionWhat it doesDefault
Wrap lines (in the diff)Wraps the long lines in the diff.Off
In blame (Preferences)The same in blame.Off
In the conflict editor (Preferences)The same in the three panes of the conflict editor.Off

Each screen's choice is remembered. The diff's is in the diff itself; the blame's and the conflict editor's also appear in Preferences › Navigation and appearance (Navigation and appearance).

See also

In a large file, two tools take you straight to the changes.

Where to find it

  • Arrows on the diff bar: Previous change and Next change. They jump to the start of the previous or next block of changes and wrap around at the end and the start of the file. They're disabled when the diff has no changes.
  • Ruler on the right edge ("Changes in this file — click to jump there"): each mark is a block of changes, in green (additions), red (removals) or in both colors. Click the ruler to go to that point.

Step by step

  1. Open the diff in the File view.
  2. Look at the ruler to see where the changes are.
  3. Click Next change to go from block to block, or click a mark on the ruler.

See also

Unstaged and Staged of the same file

When part of a file's changes is already staged and part isn't, the file appears in both sections of the panel, and the diff gets a picker to switch between the two parts without going back to the list.

Where to find it

  • On the diff bar, in the center: Unstaged | Staged. It only appears when the file is in both sections (and isn't a new file).

Step by step

  1. Stage a hunk of src/login.ts (see Staging).
  2. In the diff, click Staged: only what goes into the commit appears.
  3. Click Unstaged: what was left out appears.

The File or Diff choice is kept when you switch sides.

See also

Markdown preview

In a Markdown file, the diff can show the formatted text (headings, lists, tables, code) instead of the source code. Good for reviewing documentation.

Where to find it

  • On the diff bar, in the center, for .md, .markdown, .mdown, .mkd and .mkdn files: Code | Preview. The tooltips: "Shows the Markdown as text, with the changes" and "Shows the formatted Markdown (the whole file, newest version)".
  • Preferences › Navigation and appearance › Diff, blame and conflicts › Markdown preview › Open Markdown files in preview.

Step by step

  1. Open the diff of README.md.
  2. Click Preview. The diff switches to the whole-file view and shows the formatted Markdown ("Loading the whole file…" while it reads).
  3. Click Code to go back to the text diff.
OptionWhat it doesDefault
CodeThe diff of the file's text.On
PreviewThe whole formatted file, in the newest version.Off
Open Markdown files in preview (Preferences)Every Markdown file opens directly in the preview.Off

Caveats and messages

  • The preview shows the file as it ended up, without marking what changed. To see the changes, use Code.
  • On a deleted file, the preview shows its last version: "This file was deleted: the preview shows its last version.".
  • "The file is empty.": there's nothing to format.
  • The preview is safe: nothing in the file becomes real HTML, links open in the browser and images aren't loaded.
  • In the preview, the context, arrows, Unified/Split and Ignore whitespace controls disappear.
  • The choice between Code and Preview applies to all Markdown files and is remembered.

See also

Image diff

Images don't have a text diff, but Versora shows both versions for you to compare: side by side, with a divider that slides or one over the other with transparency. It works for PNG, JPG/JPEG, GIF, WebP, BMP, ICO and SVG.

Where to find it

  • Open an image's diff like any other file's. The image bar has Side by side | Swipe | Onion skin | Pixel.
  • SVG is image and text at the same time: the diff bar gets Image | Code ("Compares the drawing: before and after" and "Compares the SVG code, line by line"). The SVG starts as an image; in Code it has a normal text diff, with staging by hunk and by line.

The modes

ModeWhat it shows
Side by side"Before on the left, after on the right".
Swipe"One image over the other, with a divider you drag". The Divider control changes the position: before on its left, after on its right.
Onion skin"One image over the other, with adjustable transparency". The control goes from Before to After and changes the opacity of the new version.
PixelPixel-by-pixel comparison (next section).

Above each version appear the Before or After label, the dimensions (for example, 512 × 512 px), the file size and, on the new version, how much it grew or shrank. If the dimensions changed, they're highlighted ("The dimensions changed"). Both versions are drawn at the same scale, so the size difference is visible. Small images (icons) are enlarged, without smoothing, so you can see what changed.

Step by step

  1. Click the assets/logo.png file in the changes panel.
  2. Start with Side by side to see both versions.
  3. Switch to Swipe and drag the Divider control to reveal one version over the other.
  4. In Onion skin, move the control between Before and After to see the transition.
OptionWhat it doesDefault
ModeSide by side, Swipe, Onion skin or Pixel. It's remembered for the next images.Side by side
Divider / opacityPosition of the divider (Swipe) or opacity of the new version (Onion skin).In the middle

Caveats and messages

  • "New image: it didn't exist before." / "Deleted image: it no longer exists.": only one side exists, and the screen shows only that one.
  • "Both versions are identical (same bytes).": the file appears as changed, but the content is the same (for example, only the file mode changed).
  • "Image too large to preview (15 MB; the limit is 12 MB).": images above 12 MB aren't shown.
  • "This file is in Git LFS: the repository only stores a pointer, and the preview doesn't download the content." See Git LFS.
  • "Couldn't decode the image (corrupted file or unsupported format)."
  • When one of the versions can't be shown, only Side by side is available ("Available when both versions can be displayed").
  • An image can only be staged as a whole file.

See also

Pixel mode

Pixel mode compares the two versions of an image pixel by pixel and paints each pixel that changed in a highlight color, over the faded image. It finds the difference the eye can't see: an icon with one pixel swapped, a slightly different color, a shifted crop.

Where to find it

  • In an image's diff: Pixel ("Compares pixel by pixel and highlights what changed, with zoom and toggling"). It's only available when both versions can be displayed.

Step by step

  1. Open an image's diff and click Pixel. "Comparing pixel by pixel…" appears and then the result, for example "1,234 different pixels (0.5%)" and "Changed area: x 10, y 20, 30 × 40 px".
  2. Click Go to the change: the zoom increases and the screen scrolls to the changed area.
  3. Hover over the image to see the pixel's position and colors in both versions, for example "x 12, y 30 · before 255, 0, 0, 255 · after 250, 0, 0, 255" (red, green, blue and transparency).
  4. If the image only changed because of compression or color rounding, increase the Tolerance until the irrelevant differences disappear.
  5. Switch to Toggle to see one version and the other in the same place.
OptionWhat it doesDefault
Difference"Different pixels highlighted over the faded image".On
Toggle"Shows one version and the other in the same place, blinking or by hand". With Before and After you choose the version; Blink / Stop turns the automatic switching on and off.Blinking
Tolerance"Per-channel difference (0 to 255) below which a pixel counts as equal. 0 = exact pixel." The control goes from 0 to 64. Only in Difference mode.0
ZoomFit (fits the screen) or 1×, 2×, 4×, 8×, 16× and 32×, with sharp pixels.Fit

Caveats and messages

  • "The images are identical pixel by pixel (the file only changed in metadata or compression).": the file changed, but the image didn't.
  • Different dimensions: the comparison uses the area of both starting from the top left corner; what only exists in one of them counts as different.
  • "Image too large for the pixel-by-pixel comparison. Use Side by side, Swipe or Onion skin.": images with more than 25 million pixels (for example, above 5000 × 5000) can't use Pixel mode.
  • "Couldn't read the pixels of the images."
  • The highlight color follows the app theme.

See also

Other diff buttons

Some diff buttons lead to features explained on other pages:

  • Edit file (on the left of the bar, only on local changes): "Open the file in the system's default program". If the file no longer exists, "File not found: …" appears.
  • Encoding (on the right of the bar): shows how the file was read (UTF-8, Windows-1252, UTF-16…) and lets you choose another one. See Legacy encodings.
  • Owners (on the header): the file's owner according to CODEOWNERS. See Checks.
  • Blame and History: see Blame and File history.
  • Open in external diff tool icon (on the header): see git mergetool and git difftool.
  • Line history (on the bar of the chosen lines): see Line history.
  • In the diff of a commit on the current branch, each hunk has a button to move it to another commit: see Moving between commits.