Features · Staging and diffs

Stage exactly the lines you mean.

A good commit holds one change. Your working copy rarely does: the fix sits next to a rename and a debug line. Git’s staging area exists to pick what goes into the next commit, and Nori lets you pick by file, by folder, by hunk or by line, while reading the diff.

What staging is

Git commits what is in its index, also called the staging area, not what is on disk. git add copies a file’s current content into the index; git commit records the index. To stage part of a file, Git has a prompt:

git add -p src/client.ts
@@ -12,6 +12,9 @@ export function fetchWithRetry(
+  const delay = 250
+  console.log('retrying', url)
(1/3) Stage this hunk [y,n,q,a,d,s,e,?]?

y takes the hunk, n leaves it, s splits it when Git can, and e opens the patch in an editor so you can delete the lines you do not want. It works, one question at a time, without the rest of the file in view.

Staging in Nori

Stage a file or a folder from the Working copy list; a folder takes every change beneath it. To go finer, open the file’s diff. In the Hunks presentation each hunk has its own Stage hunk button, and every changed line has a stage button in its gutter. Select a range of lines to stage them together.

The file then shows as partly staged in the list, and the same buttons take a hunk or a line back out of the index.

The Hunks presentation on Workspace.swift: a Stage hunk button on each hunk, a stage button in the gutter of every changed line, and the file shown as partly staged.

Reading the diff

Three presentations: Unified, Split with the old file on the left and the new on the right, and Hunks. Long lines wrap or scroll, as you prefer. Inside a changed line, the characters that differ are marked, and code is coloured by language, with 64 themes and the font of your choice.

Images are compared before and after, side by side. A setting ignores whitespace in diffs; partial staging is switched off while it is on.

Large diffs are drawn in slices. Since Nori 1.4, a diff of 253,000 lines opens in 0.2 s, and since 1.15 closing a very large diff gives its memory back at once.

Discarding, with a way back

Discard a file, a selection of files, a whole folder or everything. In Git a discard is final: changes that were never staged are not stored anywhere. Nori snapshots the files first, so ⌘Z brings them back, untracked files included. The undo page explains where the snapshots live.

For a file that should never be committed, right-click it and choose Ignore: Nori adds the file, its extension or one of its folders to the repository’s .gitignore.

Then commit

The commit box has Amend, Push after commit and Skip hooks, and ⌘⏎ commits (Ctrl+Enter on Windows and Linux). If you have an agent CLI installed, ✦ writes the message from the staged diff, in the repository’s own conventions, as Conventional Commits or to your instructions: AI commit messages.

Limits

  • Discard works on files and folders. Discarding a single hunk or line is not offered.
  • Partial staging is unavailable while whitespace is ignored in diffs.
  • On Windows and Linux, image diffs cover PNG, JPEG, GIF, BMP, TIFF, WebP, ICO and SVG; HEIC, PSD and RAW files are not drawn.
  • Nori has no dedicated support for Git LFS.

Questions people ask

How do I stage only part of a file in Git?

git add -p <file> walks through the file hunk by hunk and asks which to stage. In Nori, click the lines or the hunk in the diff.

How do I unstage a file without losing my changes?

git restore --staged <file> takes it out of the index and leaves the file on disk as it is. In Nori, unstage the file from the list, or only the lines you added by mistake.

Can I undo a discard?

Not in Git, unless the changes were staged at some point. In Nori, yes: ⌘Z right after, or the Operations list for 30 days.