Git Diff

The diff viewer shows changes with syntax highlighting, line numbers, and two display modes — inline and side-by-side — so you can review exactly what changed.

grüt
Git diff panel showing file changes with syntax highlighting
Diff viewer with syntax-highlighted changes

Diff Sources

The diff viewer works with several types of changes:

  • Unstaged changes — differences between the working tree and the index
  • Staged changes — differences between the index and the last commit
  • Commit diffs — changes introduced by a specific commit
  • Branch comparisons — differences between two branches or refs

Select a file in the git status panel or commit detail view and grüt automatically shows the relevant diff.

Display Modes

grüt supports two diff display modes:

  • Inline — additions and deletions are interleaved in a single column. Additions are highlighted in green, deletions in red. This is the default mode.
  • Side-by-side — the old version appears on the left and the new version on the right. Changed lines are aligned for easy comparison.

Press t to toggle between inline and side-by-side mode.

Navigation

KeyAction
jScroll down
kScroll up
nJump to next hunk
NJump to previous hunk
tToggle inline / side-by-side mode
gJump to top of diff
GJump to bottom of diff
dPage down
uPage up

Syntax Highlighting

Diff output preserves the syntax highlighting of the original file. grüt detects the file language from the extension and applies the appropriate highlighting to both added and removed lines. This makes it easier to read diffs in context, especially for large changes.

Line Numbers

Both modes display line numbers from the original and modified files. In inline mode, two columns of line numbers appear — the left column shows the old line number and the right column shows the new line number. Removed lines only show the old number; added lines only show the new number.

Colors

The diff viewer uses your terminal's color capabilities:

  • Green background — added lines
  • Red background — removed lines
  • Dimmed text — unchanged context lines
  • Bold highlights — changed characters within a line (word-level diff)

Next Steps