显示整个文件的Git diff命令被修改,而不是显示修改的小部分代码 [英] Git diff command showing entire file is modified instead of showing modified small part of code

查看:474
本文介绍了显示整个文件的Git diff命令被修改,而不是显示修改的小部分代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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 - / ** - *设置路线。每个路由必须至少包含一个名称,一个URI和一组URI - 的默认值。 - / - ?> +<?php + / * + *设置路线。每个路由必须至少包含一个名称,一个URI和一组用于URI的默认值。 + * / +?>


解决方案

比较 git diff git diff -b 。空白可能是责任。重排文本可能是另一个(你没有提到你存储的内容)。


I am using git repository. Everything is working properly except git diff command. Whenever I modify any file then git diff command showing entire file is modified even though I modified small portion of the code.

What could be the reason git diff showing entire file modified instead of small portion of the code? Also let me know setting of git diff configuration.

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. + */ +?>

解决方案

Compare the output of git diff and git diff -b. Whitespace may be to blame. Reflowing text might be another (you didn't mention what you were storing).

这篇关于显示整个文件的Git diff命令被修改,而不是显示修改的小部分代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆