Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GIT中是否有一个diff工具,它只显示文本更改而不显示格式更改_Git - Fatal编程技术网

GIT中是否有一个diff工具,它只显示文本更改而不显示格式更改

GIT中是否有一个diff工具,它只显示文本更改而不显示格式更改,git,Git,我们在eclipse项目中引入了一个formatter.xml文件来自动格式化代码。我们现在遇到的问题是,在格式化之后,当我们执行 $git diff <file> $git diff 它显示添加的行数很少,删除的行数相同,尽管代码中没有引入任何更改。 我的问题是,有一个命令,它可以只显示实际更改的内容,而不会显示更改,比如因为自动格式化而将大括号移到一行上方 下面是一个例子: -public class PPCCustomerFacadeImpl<T extends P

我们在eclipse项目中引入了一个formatter.xml文件来自动格式化代码。我们现在遇到的问题是,在格式化之后,当我们执行

$git diff <file> 
$git diff
它显示添加的行数很少,删除的行数相同,尽管代码中没有引入任何更改。 我的问题是,有一个命令,它可以只显示实际更改的内容,而不会显示更改,比如因为自动格式化而将大括号移到一行上方

下面是一个例子:

-public class PPCCustomerFacadeImpl<T extends PPCCustomerData> extends      
DefaultCustomerFacade implements PPCCustomerFacade<T> 
{
+public class PPCCustomerFacadeImpl<T extends PPCCustomerData> extends 
DefaultCustomerFacade implements
+        PPCCustomerFacade<T> {
-公共类PPCCustomerFacadeImpl扩展
DefaultCustomerFacade实现PPCCustomerFacade
{
+公共类ppccustomerfacdeimpl扩展
DefaultCustomerFacade实现
+PPCCustomerFacade{

如果唯一的区别是单个行中空格的更改,那么
git diff
提供了一些选项,可以帮助您;您可以尝试
--忽略所有空格。提供更多信息。如果您想更容易键入,可以创建别名:

git config --global alias.diffis 'diff --ignore-all-space'
然后,
git diffis
将使用该选项运行diff


但是,我认为不可能忽略将非空白文本移动到另一行的更改,如您的示例中所示。按行跟踪更改是git的基本原则。

谢谢您的回答Wally。看起来没有什么可以实现我想要的:(.虽然我想多回答几个专家问题,然后从中选择合适的正确答案。