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?

asked Aug 28, 2014 by Eric Z Ma (44,280 points)

1 Answer

 
Best answer

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
answered Aug 28, 2014 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...