Skip to content

Diff view

You can use the Diff view to compare file versions with syntax highlighting, linked scrolling, and change navigation.

A working-tree diff opened from Staging updates when you save the file or another program changes it. If its tab is hidden, it updates when you return. The text comparison keeps its view mode, scroll position, and expanded unchanged context where possible. New edits remain unstaged until you stage them. Unsaved editor changes are not included.

To open a file in the Diff view, click the file in Staging. You can also access the Diff view when viewing commits or branch comparisons.

The following table describes each icon in the Diff view header.

IconAction
Side-by-side viewSwitches the current view to Side-by-side view.
Unified viewSwitches the current view to Unified view.
Rendered viewSwitches the current view to Rendered view. Disabled for a file that has no rendered form.
Working file viewShows the file as it is on disk, read only. Available only for conflicted text files.
Toggle context collapseAuto-collapses long regions of unchanged code
Toggle word wrapWraps long lines of code.

In a diff opened from Staging, Changes: in the header shows which change is current, for example 1 of 3. Click the Previous change icon and the Next change icon to move through the changes. In a narrow pane, these controls move to a second line below the file name.

To copy text from the diff, select it, right-click on it, and click Copy. Where the diff has hunk and line actions, Copy is above them. See Copy selected text.

Minimap

The minimap beside the diff has two renderings. Blocks shows one mark for each run of changes. Minimap shows the shape of the diff. Point to a mark to see the lines it covers and what changed there. Click the mark to scroll to that change. To change the minimap, right-click in the diff or on the minimap and choose Minimap, Blocks, or Hidden under Minimap.

Diffs start with Blocks. Your choice applies to every diff, including the Sidebar layout of the Diffs view and the Changes view of a pull request, and Zide keeps it after a restart. The Rendered view, the Working file view, and the Stacked layout of the Diffs view have no minimap. A diff that fits in the pane shows none, and the menu says why.

Renamed, moved, and copied files

The header shows the file name and the folder path that contains it. Click the file name to open the file. Click a folder to show it in the File Browser.

When a commit renames, moves, or copies a file, the header shows the changed part as before → after. A staged rename that you open from Staging shows the same header. Only the part that changed splits in two: a file that moved keeps one name and shows two folder paths, and a file that was renamed in place keeps one folder path and shows two names. Every folder in both paths stays clickable. The Diff view compares the two paths, so it reads the before side at the old path.

A name you can click is a file that is on disk now.

ChangeFile name
Added or modifiedOpens the file.
DeletedPlain text, because the file is gone.
Renamed or movedThe before name is plain text, because that path is gone. The after name opens the file.
CopiedBoth names open their own file, because a copy leaves the source where it was.
SubmoduleShows the submodule in the Submodules tab of the current project. A submodule is a folder, so there is no file to open. Not available when the repository no longer lists the submodule.

In the Sidebar layout of the Diffs view, the header above the diff works the same way.

When you open a submodule from Staging, a section below the Staging banner tells you what the change does to the submodule’s recorded commit. It shows the two commits that Zide compares and a Show commits button, and each commit opens from the submodule’s repository. See Review a submodule change.

Side-by-side view

Side-by-side view displays two panels side-by-side with removals on the left and additions on the right. Removals are highlighted in red and additions are highlighted in green. Scrolling is linked between panels.

Unified view

Unified view displays all changes to a file on a single panel. Removals are prefixed by - and highlighted in red. Additions are prefixed by + and highlighted in green.

Rendered view

Rendered view shows the two revisions as finished documents in two panels, with linked scrolling, so you can compare the result of the change.

It is available for these document formats:

FormatExtensions
Markdown.md, .markdown, .mdx, .mdown, .mkd, .mkdn, .rmd, .qmd
AsciiDoc.adoc, .asciidoc, .asc
Org Mode.org
reStructuredText.rst, .rest

For all other files the Rendered view icon stays in the header, disabled, because those files have no rendered form.

Rendered view is read only. It does not highlight changes or show hunk or line staging controls. To stage a hunk or a line, switch to Side-by-side view or Unified view. The actions in the Staging banner stay available.

Zide remembers Rendered view and uses it for the next document diff you open.

Staging banner

A diff that you open from Staging shows one section of the file’s changes, and a banner above the diff tells you which:

BannerDiffActions
STAGED CHANGESHEAD compared with Staged: the changes for the next commitUnstage File
UNSTAGED CHANGESStaged compared with Working Tree: the changes that are not stagedDiscard… and Stage File

When the file also has changes in the other section, the banner says so and adds Show Staged Changes or Show Unstaged Changes. Click it to show those changes in the same tab. Staging then selects the file in that section.

Discard… discards the changes in the working file and asks you to confirm first. When the file also has staged changes, the button is Discard Unstaged Changes…, and the staged changes are kept. For an untracked file, the button is Delete File….

For a staged rename, the banner says that the view shows a staged rename. A rename with no content changes shows no changed lines, and the banner says that too. Unstage File unstages the old path and the new path together. See Renamed files.

A submodule keeps its own comparison of both sections. Its banner reads STAGED, UNSTAGED, or PARTIALLY STAGED, with Stage Submodule and Unstage Submodule as they apply. See Review a submodule change.

Stage and unstage hunks

Click Staged or Unstaged next to a hunk to stage or unstage that change. The change moves to the other section, so it leaves the diff. To move it back, show the other section’s changes and click it there. Ctrl+click (Cmd+click on macOS) stages or unstages one line.

If a hunk or line action uses an outdated diff, Zide makes no changes and reloads the Diff view. Review the diff, then try again.

In a staged rename, unstaging a hunk or a line changes only the new file. The rename stays staged.

A file that a Git filter changes, such as a Git LFS file, has no hunk or line staging controls. Stage or unstage the whole file from the banner. See Files that Git filters. A binary file is also staged as a whole file. Stage File stages an untracked file as a whole file, because Git has no staged version of it yet.

When a section has no more changes

When you stage or unstage the last change in the diff and the file still has changes in the other section, the file moves to that section in Staging. The Diff tab follows the file and shows the changes in that section.

The Diff tab shows No staged changes or No unstaged changes instead when:

  • The file has no changes in either section. For example, you discard its last unstaged change while nothing is staged. The file leaves Staging, and the tab offers Close Tab.
  • The tab is pinned, you opened it with Open Diff in New Tab, or Ask Zide is open beside it. The tab stays on its section and adds Show Staged Changes or Show Unstaged Changes when the file has changes in the other section.

Binary files

Use Preview and Hex view in the Diff tab header to switch views.

  • Preview compares images, audio, and video and is the default for these file types.
  • Hex view shows each version’s bytes in its own column, with linked scrolling and differing bytes highlighted. Other binary files, such as .bin, .dat, executables, archives, and fonts, open in this view with Preview disabled.

Each tab remembers your choice.

A binary Diff tab has no Side-by-side view and Unified view buttons. It uses the setting that you last selected in a text diff or in the Diffs view. With Unified view, Preview shows the two versions in one column, the old version above the new version. For images, this applies to the Side by Side image mode; Swipe, Onion Skin, and Blink always show one image. Hex view always shows two columns, because it compares the bytes at the same offset.

Bytes are compared at the same offset, so inserting or removing one byte can mark all later bytes as changed. A version larger than 256 MiB shows its size instead of a hex view.

Large files and large changes

The Diff view and the Diffs view use the same limits, so a diff that you open in its own tab works the same way.

  • A text file larger than 5 MB is too large to compare as text. Zide compares its bytes in Hex view instead. The header reads Diff (too large):, and a line above the columns shows the size of the file and the limit.
  • A diff that shows more than 20,000 rows does not show its lines immediately. A message shows how many lines changed. Click Show Diff to show the diff. This can take a few seconds. Unified view shows a replaced line as two rows, so Unified view can reach the limit when Side-by-side view does not. If you change the view or turn off Toggle context collapse, Zide shows the message again when the new view has more than 20,000 rows. After you click Show Diff, that diff shows in all views.
  • A diff that has more than 10,000 rows in Side-by-side view has no syntax highlighting, in either view. This limit counts a replaced line once, also in Unified view.
  • A change that is too large to match line by line shows the message Too many changes to match every line. Some unchanged lines are shown as removed and added. The diff still shows every line of both versions. Some lines that did not change can show as removed and then added.

Diffs view

The Diffs view shows all the files that a commit, a stash, a reflog entry, or a comparison of two refs changed. To open it, click View Diffs or a file in the Changed Files section of those views. When you click a file, the Diffs view selects it and highlights it for a moment. See Changed files.

The header names the change: the commit hash, stash@{0}, HEAD@{2}, or the two refs, then the commit message or another subject. Click the hash or the name to go back to the view that you opened the Diffs view from. If you closed that view, Zide opens it again.

The number of files and the lines added and deleted are above the file list.

Layout and style

The header has these controls. Each control works independently of the others.

ControlAction
Show filtersShows the filters for the file list.
List view, Tree viewShows the files as a list or in their folders.
Stacked layoutShows the files in one list. Click a file to show its diff below it, and click it again to hide the diff. You can show many diffs at the same time.
Sidebar layoutShows the file list at the side and the diff of one file next to it. Click a file to show its diff. In a narrow pane, the list is above the diff.
Side-by-side view, Unified viewShows all the diffs in the Diffs view side by side or in one column.

In the Stacked layout, Zide keeps the 20 diffs that you hid most recently. When you show a diff that you hid before those, Zide reads the file again.

Zide keeps your layout and your list or tree choice for the next Diffs view. Diff views and the Diffs view use the same Side-by-side view and Unified view setting. A Diffs view uses your last choice each time you go to it. A Diff view that is already open keeps its view until you change it there.

Open a diff in its own tab

To keep a diff open while you look at other files, open it in its own Diff view:

  • In the Sidebar layout, click Open in New Tab above the diff.
  • In the Stacked layout, click the Open in New Tab icon at the end of the row.
  • Ctrl+click (Cmd+click on macOS) or middle-click a file in the list.

Filter the files

Click Show filters in the header. Type in Filter files to filter by name, and select a Status. While a filter is set, a line below the header says how many files match, for example 1 match. Each filter that is set shows as a chip above the count, for example Status: Deleted and Search: src. Click a chip to change the filter, or click its x to remove it. To remove all of them, click Clear filters at the end of the count line. In a narrow panel the button says Clear. Ctrl+F (Cmd+F on macOS) also opens the filters.

When you open the Diffs view at a file that a filter hides, Zide clears the filter so that the file shows.

Keyboard

KeyAction
Up Arrow, Down Arrow, Home, EndWhen the file list has focus, selects another file. In the Stacked layout, moves the focus only.
EnterShows the diff of the focused file. In the Stacked layout, Space also shows or hides it.
Ctrl+Enter (Cmd+Enter on macOS)Opens the focused file in its own Diff view.
J, KSelects the next or the previous file.
N, Shift+NGoes to the next or the previous change, in the Sidebar layout.

Conflicts

When you open a conflicted file from Staging, the Diff view shows the two sides below a conflict bar. For the actions in the bar, see Resolve a conflicted file.

When the file is resolved, the Diff view shows Conflict resolved. Click Open Staging to go back to Staging and continue with the other files, or click Close Tab. Open Staging keeps the Diff view open. To finish the operation, use the conflict banner in the Project Header.

Assist with This

Right-click the tab of a Diff view or the Diffs view and point to Assist with This. Under Zide Assist, click Add to Conversation to attach the diff to a Zide Assist tab. For more information, see Attach items to a message.

Under Ask Zide, click Open Ask Zide. Zide opens an Ask Zide panel beside the tab. In the panel, click Summarize Changes or Review Changes. In a Diff view, these tasks use the file on screen. In the Diffs view, they use all the files of the commit, stash, reflog entry, or comparison. For a conflict, the Diff view offers Explain Conflict, Suggest Resolution, and Review Conflict. Ask Zide does not edit, stage, or resolve files. See Ask Zide beside a tab.

Language servers

When viewing a working-tree diff, resting the pointer on a symbol displays its type and documentation. In Side-by-side view, hover information is available on the right panel. In Unified view, it is available on added and unchanged lines. Removed lines and diffs between committed versions do not provide hover information because the language server only knows the current working-tree file.

See Language servers for installation and settings.