Git 在保存并添加空格时重新格式化整个文件

Git reformatting entire file upon save and adding whitespace

我正在使用 Rider & Git,每当我保存任何 C# 文件时,它都会重新格式化整个文件,差异始终是整个文件。

在查看 GitHub PR window 时,如果我单击“隐藏空格”,我只能看到我的更改;有没有办法禁用此功能以防止它发生?

我假设这是我启用的本地 Git 配置设置。

It's highly likely that this is done by your IDE and not by git itself. There are hooks where you can add scripts to git that do something like that, but it's way more common that your IDE does that. It's often labeled "reformat on save" or something like that. Are you working on an existing project or have you set up your own?

是的,这是更改行分隔符的 Rider 设置。