gpt4 book ai didi

git 应用 : error trailing whitespace

转载 作者:太空狗 更新时间:2023-10-29 13:29:41 29 4
gpt4 key购买 nike

最近,我一直在玩 git。我正在尝试模拟将补丁应用到我的 master 分支,这个补丁包含一个提交,我在其中向 java 操作添加了一些注释。我使用 git format-patch 生成了补丁。然后我切换到我的主分支来应用补丁。执行git apply命令时出现如下错误:

path/to/my/patch/file: line x
path/to/my/patch/file: line x+1
path/to/my/patch/file: line x+2
path/to/my/patch/file: line x+3

我注意到我还尝试了以下参数:--ignore-spaceignore-whitespace

最佳答案

如果您不关心将尾随空格应用到您的存储库中,您可以使用标志 --whitespace=fix 来忽略错误并仍然应用

git apply --whitespace=fix your.patch

我听说有人说默认是警告并应用补丁,但这不是我的经验,上面的解决方案似乎符合我的要求。

关于git 应用 : error trailing whitespace,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15732528/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com