Black Friday sale: 30% off Flywrite

A word diff is a comparison of two versions of a text that marks the individual words removed and added, instead of every line that changed.

Why prose needs one

A line diff marks every line that changed. Code has short lines, so that works. A Markdown paragraph is often one long line, so changing one word marks the whole paragraph as removed and added, and you hunt for the difference. A word diff shows it in place.

With Git

Add --word-diff to any git diff command:

git diff --word-diff
This week [-we shipped-]{+brought+} three small updates.

By default, Git treats anything between spaces as a word. Two other modes help:

  • --word-diff=color shows the changes in color only.
  • --word-diff-regex=. compares character by character, for typos and punctuation.

Git builds a word diff from its line diff, so on heavily rewritten text the output can be longer than a dedicated word-diff tool's.

In Flywrite

Flywrite has no diff view: it saves checkpoints and restores from them. Each checkpoint is a Git commit, so in the project's terminal, git diff HEAD --word-diff shows the words changed since the latest checkpoint, in files that checkpoint already tracked. It needs Git on the command line.

Questions

What do [- -] and {+ +} mean in a word diff?

In Git's plain word diff, words between [- and -] were removed and words between {+ and +} were added. Everything else is unchanged.

Can I see only the colors, without the brackets?

Yes. git diff --word-diff=color, or git diff --color-words, marks the changed words in color in your terminal.

Sources
  1. Git documentation: git-diff. Checked .
  2. Flywrite docs: Checkpoints & versions. Checked .

Write with your agent in a writing app.

Buy now