diff git
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.
我发现当文本文件包含的行足够长以超过屏幕尺寸时, git diff
输出不容易阅读。
We may not forbid the using the long lines for all files.
我们可能不禁止对所有文件使用长行。
How to handle lone lines in git diff
better?
如何更好地处理git diff
孤立行?
Two possible methods to make git diff
with long lines easier to read:
使长行git diff
易于阅读的两种可能方法:
Method 1: Git can highlight changes in lines instead of showing two lines of each version:
方法1:Git可以突出显示行中的更改,而不是显示每个版本的两行:
git diff --word-diff
It will prints changes in format like:
它将以以下格式打印更改:
[-deleted word-]{+added_word+}
Method 2: Make git wrap long lines:
方法2:使git换行长行:
PAGER='' git diff --word-diff
diff git