The app
Diffs
Open the working tree, staged changes or a branch comparison, and read, fold and mark files as you go.
riff reads your git repository directly and shows a diff one file at a time, with a file list beside it. This page covers the local diff and the diff view itself, which pull requests use too.
Open a diff
riff # the repository in the current directoryriff ~/code/project # another repositoryThe app opens on your repository. Choose Working tree in the sidebar, then pick what to compare in the selector at the top:
| Choice | Shows |
|---|---|
| Uncommitted changes | Everything in the working tree against HEAD |
| Staged | HEAD against the index |
| Unstaged | The index against the working tree |
| Current branch against name | Your branch against another branch, from their merge base |
Working tree diffs update when files change on disk.
For a commit, an exact range (a..b, a...b) or two files, print the diff in the terminal with riff-diff, which also has a split layout, algorithm and context options the app doesn’t.
Pull requests open from the PR list; see Pull requests.
The file list
The list on the left shows every changed file, how much changed, and how many you have viewed. Large diffs load file by file, so the first file shows before the rest are read.
- Groups puts files in sections: Code, Tests, Translations, Config & docs, Assets and Generated. Tree shows folders. On a pull request, Story (the default once it is built) lists the files in chapters, each with a one-line reason, marks the file to Start here with, and shows a test file as a + test chip on the file it covers. The order follows how the files depend on each other.
- All / Code / Tests narrows the list when the change has tests.
- The filter box at the top matches file names.
/focuses it;Enteropens the first match;Escclears it. - Below 1280 px wide the list is a drawer.
fshows or hides it. Drag its edge to resize it. - Next to each file: its status (A, M, D, R), added and removed lines, a message icon with its open threads, and a dot for unsent drafts.
Files you ignore, and files that only change imports or comments when those are folded, are listed under Ignored or Hidden with the reason.
Reading a file
Each file shows its hunks in unified form: removed lines, added lines, and a few lines of context. Syntax is highlighted, and within a changed line the words that differ are highlighted too.
A thin ruler along the scrollbar marks added and removed lines, threads and drafts in the file, so you can see where the changes are.
Each hunk header shows the enclosing scope, such as the function or class the change sits in, so you know where you are without scrolling up.
Show more context
Between hunks, a button shows the hidden lines. Click it to reveal them all, or use the 20 buttons to reveal 20 lines at a time next to the change. e expands the whole file.
Whitespace
Lines that differ only in indentation are folded into one row marked ⇥, and the hunk header counts them (“3 lines only re-indented”). Press w, or click the chip, to show them as removed and added lines; press w again to fold them.
To compare lines ignoring whitespace entirely, turn on Ignore whitespace changes in the View options menu (the sliders icon in the file header). Diffs reload when it changes.
View options
The View options menu holds the toggles you’ll use most. All of them are also in Settings → Diffs.
| Option | Effect |
|---|---|
| Wrap long lines | Wraps code instead of scrolling sideways |
| Ignore whitespace changes | Compares lines ignoring changes in whitespace |
| Fold imports | Collapses import blocks |
| Fold comments | Collapses comment-only changes |
| Also fold one-line comments | Folds single-line comments too (needs Fold comments) |
A fold opens when you click it. A fold that holds a line with a thread or a draft stays open. A file whose changes are all folded kinds moves to Hidden in the list.
Declarations in new files
A new file is shown as one long run of added lines, so riff adds an outline on top: a chip per top-level declaration (function, class, struct, interface, type, enum, constant). Click a chip to jump to it. Each declaration also has its own header with its line range.
For exported declarations, Used by N files shows where the changed files that import it use it, as short excerpts under its header.
Outlines cover TypeScript, JavaScript, Java, Rust, Go and Python. Other files show as plain added lines.
Mark files viewed
Press v, or click Viewed in the file header, to mark a file viewed and move to the next one you haven’t. Progress (“12 of 40 viewed”) shows in the file list, or beside the file name when the list is closed.
Marks are saved with the repository. If a file changes after you marked it, it shows Changed since viewed and goes back into your unviewed queue.
Left to review in the file list holds shortcuts to the files that need you:
| Queue | Files |
|---|---|
| Changed since review | Files that changed since you marked them viewed (on a PR, since your last review) |
| Open threads | Files with unresolved review threads |
| Drafts | Files with your unsent comments |
| Unviewed | Files you haven’t marked |
Pick a queue to list only those files, then use ] and [ to step through it; Clear drops the queue. When no queue is picked and the PR has open threads, ] and [ step through the threads. When nothing is left, the list says Ready to submit.
Other things in the header
- Copy path and Open on GitHub (pull requests) are in the file actions menu (the ⋯ button).
- A renamed file shows where it came from.
- The keyboard icon lists the shortcuts. All of them are in Keyboard shortcuts.