With full credit to Josh Diehl in a comment to this answer, I nevertheless feel like this ought to be an answer unto itself, so adding it:
One way to deal with seeing differences in long lines is to use a word-oriented diff. This can be done with:
git diff --word-diff
In this case, you'll get a significantly different diff output, that shows you specifically what has changed within a line.
For example, instead of getting something like this:
diff --git a/test-file.txt b/test-file.txt
index 19e6adf..eb6bb81 100644
--- a/test-file.txt
+++ b/test-file.txt
@@ -1 +1 @@
-this is a short line
+this is a slightly longer line
You might get something like this:
diff --git a/test-file.txt b/test-file.txt
index 19e6adf..eb6bb81 100644
--- a/test-file.txt
+++ b/test-file.txt
@@ -1 +1 @@
this is a [-short-]{+slightly longer+} line
Or, with colorization, instead of this:
You might get this:
Now, if you're comparing a really long line, you may still have issues with the pager situation you originally described, and which has been addressed, apparently to satisfaction, in other answers. Hopefully this gives you a new tool, though, to more easily identify what on the line has changed.
git diff --color-words | fold
– Legaultfold
but it removes color. Since you specify--color-words
I assume you managed to pass colors tofold
. How? – Lively