本文介绍了git apply对文件不做任何更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须对我的仓库应用补丁并正在运行

I have to apply a patch to my repo and am running

git apply --directory=$PWD xxxxx.patch

出于我不愿讨论的原因,在这种情况下,我不能使用git am,而我需要使用目录标志.

For reasons I won't go into, I cannot use git am in this instance, and I need to use the directory flag.

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都不会应用该修补程序.存储库中的当前文件均未更改.知道该怎么办吗?

I have read that the whitespace warning is nothing serious and should not stop git from applying the patch. However, whatever the reason, git is not applying the patch. None of the current files in the repo are changing. Any idea what to do about this?

推荐答案

我注意到 git apply文档:

I note the following boldfaced (my boldface) sentence in the git apply documentation:

在这种情况下,git patch似乎正在确定文件在目录之外.如果从顶层运行,它应该停止确定(尽管$PWD本身也会改变;如果需要,任何--directory选项都将需要一个不同的参数).

It seems in this case that git patch is deciding that the files are outside the directory. If run from the top level, it should stop deciding that (though of course $PWD itself will change too; any --directory option, if one is required, would need a different argument).

这篇关于git apply对文件不做任何更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 15:29