Git diff with long lines

I find git diff output is not easy to read when the text file contains long lines that is long enough to exceeds the screen size.

We may not forbid the using the long lines for all files.

How to handle lone lines in git diff better?

Two possible methods to make git diff with long lines easier to read:

Method 1: Git can highlight changes in lines instead of showing two lines of each version:

git diff --word-diff

It will prints changes in format like:

[-deleted word-]{+added_word+}

Method 2: Make git wrap long lines:

PAGER='' git diff --word-diff

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *