Skip to content

Commit cef3b4a

Browse files
mmontalbogitster
authored andcommitted
doc: clarify that --word-diff operates on line-level hunks
The --word-diff documentation describes the output modes and word-regex mechanics but does not explain that word-diff operates within the hunks produced by the line-level diff rather than performing an independent word-stream comparison. This can surprise users when the line-level alignment causes word-level changes to appear even though the words in both files are identical. Add a short note explaining the two-stage relationship. Signed-off-by: Michael Montalbo <mmontalbo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 67ad421 commit cef3b4a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Documentation/diff-options.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,11 @@ endif::git-diff[]
455455
+
456456
Note that despite the name of the first mode, color is used to
457457
highlight the changed parts in all modes if enabled.
458+
+
459+
Word diff works by finding word-level changes within each hunk of
460+
the line-level diff. The line-level alignment determines which
461+
changed lines are compared to each other, which can affect the
462+
word-level output.
458463

459464
`--word-diff-regex=<regex>`::
460465
Use _<regex>_ to decide what a word is, instead of considering

0 commit comments

Comments
 (0)