Git diff ignore whitespace-Git diff -w ignore whitespace only at start & end of lines

567    Asked by DanPeters in Data Science , Asked on Jul 8, 2021

I love to use git diff -w to ignore whitespace differences. But, I just noticed that it ignores even whitespace differences in the middle of lines. How could I use git diff ignore whitespace to ignore whitespace differences that come at the start (^) or end ($) of lines?
Answered by Gabrielle Dowd

You can use git diff ignore whitespace for end of the line as shown below:

    $ git diff --ignore-space-at-eol

Instead of using it for all space:

    $ git diff -w (--ignore-all-space)

Unfortunately, there is no built in solution for start of line.



Your Answer

Interviews

Parent Categories