有没有办法在不改变格式的情况下比较 Git 中的两个文件?

pra*_*ava 2 git github git-svn

我提交了一些具有某种格式的代码,但源代码具有某种其他格式。审阅者要求我恢复所有更改,我正在寻找一些 UI 工具或 Git 中的某种方法来删除格式并给出实际结果。

edi*_*999 5

我想您可能会查看 git diff,特别是以下两个选项:

-b, --ignore-space-change
   Ignore changes in amount of whitespace. This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters to be equivalent.

-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)

所以跑步 git diff --ignore-all-space

但是,如果您通过格式化定义的不仅仅是空格,我想您必须手动完成