* [PATCH] doc: clarify that --word-diff operates on line-level hunks
@ 2026-05-13 15:42 Michael Montalbo via GitGitGadget
0 siblings, 0 replies; only message in thread
From: Michael Montalbo via GitGitGadget @ 2026-05-13 15:42 UTC (permalink / raw)
To: git; +Cc: Michael Montalbo, Michael Montalbo
From: Michael Montalbo <mmontalbo@gmail.com>
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>
---
doc: clarify that --word-diff operates on line-level hunks
CC: Vincent Lefevre vincent@vinc17.net, Johannes Sixt j6t@kdbg.org
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2113%2Fmmontalbo%2Fmm%2Fdoc-word-diff-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2113/mmontalbo/mm/doc-word-diff-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2113
Documentation/diff-options.adoc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/diff-options.adoc b/Documentation/diff-options.adoc
index 8a63b5e164..665473e61a 100644
--- a/Documentation/diff-options.adoc
+++ b/Documentation/diff-options.adoc
@@ -457,6 +457,11 @@ endif::git-diff[]
+
Note that despite the name of the first mode, color is used to
highlight the changed parts in all modes if enabled.
++
+Word diff works by finding word-level changes within each hunk of
+the line-level diff. The line-level alignment determines which
+changed lines are compared to each other, which can affect the
+word-level output.
`--word-diff-regex=<regex>`::
Use _<regex>_ to decide what a word is, instead of considering
base-commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0
--
gitgitgadget
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-13 15:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13 15:42 [PATCH] doc: clarify that --word-diff operates on line-level hunks Michael Montalbo via GitGitGadget
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox