Skip to content

Diff view

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

To open a file in the Diff view, click it in the Staging activity. 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.
Toggle context collapseAuto-collapses long regions of unchanged code
Toggle word wrapWraps long lines of code.
Toggle scrollbar change indicatorsEnables indicators on the scrollbar that show where changes are in a file.

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.

In Side-by-side view and Unified view, you can navigate through lines of changes or hunks in the file. Press the Previous change icon and the Next change icon to navigate through changes in the file.

Staging controls

You can stage and unstage files and hunks when you open a file in Diff view from the Staging activity. Click Stage File to stage the entire file and Unstage File to unstage the file. Click Staged or Unstaged next to the hunk to stage or unstage that specific change.

Binary files

The Diff view handles binary files with specialized previews. For example, images display a side-by-side image preview. For binary files that do not have a specialized preview, the Diff viewer displays a Binary file differs message.