Diff view
You can use the Diff view to compare file versions with syntax highlighting, linked scrolling, and change navigation.
Navigate the Diff view
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.
| Icon | Action |
|---|---|
| Side-by-side view | Switches the current view to Side-by-side view. |
| Unified view | Switches the current view to Unified view. |
| Toggle context collapse | Auto-collapses long regions of unchanged code |
| Toggle word wrap | Wraps long lines of code. |
| Toggle scrollbar change indicators | Enables 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.