make git-diff ignore new lines

32 views Asked by At

I am modifying a long-ish text manuscript, putting one sentence per line, where before I had one paragraph per line.

I would like to carefully check (using git-diff) that I made no mistakes. Which git-diff command would tell me there is no difference between these two:

(before:)
This is the first sentence. This is the second sentence.

(after:)
This is the first sentence.
This is the second sentence.

1

There are 1 answers

3
Schwern On BEST ANSWER

You can use --word-diff. It's usually used to see small changes in long lines.

By default it uses whitespace to delimit words, as a side-effect it ignores whitespace changes.

Newline-only changes will still show up as hunks, but there will be no highlighted change. You can use -U0 to reduce these to just a change marker.

If you just want to see if anything changed, you can use the various --stat options.


If you have a non-Git diff program which does what you want, you can use it with git-difftool.