Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.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恢复行尾空白更改?_Git_Diff_Whitespace_Git Diff_Removing Whitespace - Fatal编程技术网

如何使用git恢复行尾空白更改?

如何使用git恢复行尾空白更改?,git,diff,whitespace,git-diff,removing-whitespace,Git,Diff,Whitespace,Git Diff,Removing Whitespace,在具有大量尾随空白的遗留代码库上应用修补程序时,有时会将工具配置为去除空白* 我希望这将是如此简单: git diff --ignore-space-at-eol > changes.diff git stash git apply changes.diff …如果一切顺利,那就把藏品扔了 不幸的是,我已经尝试了很多次,但在应用修补程序时经常出现以下错误: patch does not apply 在某些情况下,在不使用git的情况下使用patch,会产生一些模糊警告 是否有一种可靠的

在具有大量尾随空白的遗留代码库上应用修补程序时,有时会将工具配置为去除空白*

我希望这将是如此简单:

git diff --ignore-space-at-eol > changes.diff
git stash
git apply changes.diff
…如果一切顺利,那就把藏品扔了

不幸的是,我已经尝试了很多次,但在应用修补程序时经常出现以下错误:

patch does not apply
在某些情况下,在不使用git的情况下使用
patch
,会产生一些模糊警告

是否有一种可靠的方法来恢复空白剥离



*也许我们应该咬紧牙关,去掉空白,这是另一天的讨论:D

Try
git apply changes.diff--忽略空白更改
git apply changes.diff--忽略空白