git apply 未对文件进行任何更改
git apply is making no changes to files
我必须对我的存储库应用补丁,并且 运行
git apply --directory=$PWD xxxxx.patch
由于我不会深入的原因,在这种情况下我不能使用 git am
,我需要使用目录标志。
git 告诉我:
$> git apply --directory=$PWD xxxxx.patch
code1/xxxxx.patch:337: trailing whitespace.
< one partial line of code >
warning: 1 line adds whitespace errors.
我读到空白警告并不严重,不应阻止 git 应用补丁。但是,无论出于何种原因,git 都没有应用补丁。存储库中的 None 个当前文件正在更改。知道该怎么办吗?
我在 the git apply
documentation 中注意到以下粗体字(我的粗体字)句子:
Reads the supplied diff output (i.e. "a patch") and applies it to files. When running from a subdirectory in a repository, patched paths outside the directory are ignored. With the --index
option ...
在这种情况下,git patch
似乎决定文件在目录之外。如果来自顶层的 运行,它应该停止决定(当然 $PWD
本身也会改变;任何 --directory
选项,如果需要的话,都需要一个不同的参数)。
我必须对我的存储库应用补丁,并且 运行
git apply --directory=$PWD xxxxx.patch
由于我不会深入的原因,在这种情况下我不能使用 git am
,我需要使用目录标志。
git 告诉我:
$> git apply --directory=$PWD xxxxx.patch
code1/xxxxx.patch:337: trailing whitespace.
< one partial line of code >
warning: 1 line adds whitespace errors.
我读到空白警告并不严重,不应阻止 git 应用补丁。但是,无论出于何种原因,git 都没有应用补丁。存储库中的 None 个当前文件正在更改。知道该怎么办吗?
我在 the git apply
documentation 中注意到以下粗体字(我的粗体字)句子:
Reads the supplied diff output (i.e. "a patch") and applies it to files. When running from a subdirectory in a repository, patched paths outside the directory are ignored. With the
--index
option ...
在这种情况下,git patch
似乎决定文件在目录之外。如果来自顶层的 运行,它应该停止决定(当然 $PWD
本身也会改变;任何 --directory
选项,如果需要的话,都需要一个不同的参数)。