显示整个文件的Git diff命令被修改,而不是显示修改过的小部分代码

Rah*_*hul 20 git

我正在使用git存储库.一切正常,除了git diff命令.每当我修改任何文件时,即使我修改了一小部分代码,也会修改显示整个文件的git diff命令.

可能是什么原因导致git diff显示整个文件被修改而不是代码的一小部分?另请告诉我git diff配置的设置.

diff --git a/application/routes.php b/application/routes.php
index 2842f8d..6629d16 100755
--- a/application/routes.php
+++ b/application/routes.php @@ -1,671 +1,676 @@ -<?php -/** - * Set the routes. Each route must have a minimum of a name, a URI and a set of - * defaults for the URI. - / -?> +<?php +/* + * Set the routes. Each route must have a minimum of a name, a URI and a set of + * defaults for the URI. + */ +?>
Run Code Online (Sandbox Code Playgroud)

Set*_*son 23

比较器的输出git diffgit diff -b.空白可能是罪魁祸首.回流文本可能是另一个(你没有提到你存储的内容).


ral*_*nja 11

该文件以unix模式或Windows模式(具有不同的行结尾)存储,当您保存文件时,将以相反的格式保存.


Sky*_*sey 1

您的编辑器是否设置为自动重新格式化代码?是否是文件使用制表符缩进,而您将其更改为使用空格?