如何使 svndiff 只显示两个修订版之间的非空白行变化

我可以用类似于

svn diff -r 100:200 > file.diff

但问题是,由于空格的改变,会出现许多行。有没有一种方法可以只写那些实际上以重要的方式而不只是在空格中改变的行?

54331 次浏览

You can use an alternate diff command using the --diff-cmd argument for svn diff. diff is a good utility that has plenty of features for ignoring whitespace.

For example:

svn diff --diff-cmd /usr/bin/diff -x "-w"

You can use

svn diff -r 100:200 -x -b > file.diff

If you want to ignore all whitespaces:

svn diff -x -w | less

Source

Use -x --ignore-space-change or -x --ignore-all-space. (See svn -h diff.)

Note that end-of-lines are not considered whitespace in this scenario and that has to be ignored with:

svn diff -x --ignore-eol-style [etc...]