为什么 github 将我的所有代码突出显示为 red/green,即使没有任何更改?

Why is github highlighting all my code to red/green even though nothing was changed?

一张图片说明一切(注意:启用隐藏空白更改)

有人向我提交了拉取请求,当我尝试查看更改时,github 只是说我所有的原始代码都已删除,并被完全相同的代码替换。

我在 mac 发展,我相信提交公关的人在 windows 发展。是什么原因造成的,是否有快速解决方法?

There is a way to tell your local Git to preserve the original line endings coming from the server.

问题是:

  • 差异在远端完成。
    即使您的 local 配置已完成 git config --global core.autocrlf false,您仍然会看到此问题。

  • 差异是在您的远程代码和拉取请求之间完成的,由其他人提交(使用错误的 eol):he/she 需要 fix the sources eol,然后再次推送同样的 PR 来更新它。

也就是说,在 GitHub 上查看差异时,您可以要求 ignore whitespace changes:将 ?w=1 添加到 URL 以查看带有空格的差异忽略。
(自