根据官方git 文档:
git diff
-w, --ignore-all-space
Ignore whitespace when comparing lines. This ignores differences
even if one line has whitespace where the other line has none.
Run Code Online (Sandbox Code Playgroud)
然而,基本测试表明事实并非如此。
somefile.txt
使用以下内容
创建:git add somefile.txt
cp somefile.txt somefile.orig.txt
somefile.txt
:
git diff -w somefile.txt > somefile.gitdiff
diff -uw somefile.orig.txt somefile.txt > …
根据官方git 文档:
git apply
--ignore-space-change, --ignore-whitespace
When applying a patch, ignore changes in whitespace in context lines if necessary.
Context lines will preserve their whitespace, and they will not undergo whitespace fixing
regardless of the value of the --whitespace option. New lines will still be fixed, though.
Run Code Online (Sandbox Code Playgroud)
然而,基本测试表明这是一个该死的谎言。
somefile.txt
使用以下内容
创建:git add somefile.txt
cp somefile.txt somefile.orig.txt
somefile.txt
: