Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
尝试使用以下方法应用补丁时出现此错误git am:
git am
error: git diff header lacks filename information when removing 1 leading pathname component (line 9)
补丁是使用 git 自己的format-patch命令创建的,没有以任何方式编辑,有什么问题?
format-patch
原来这是因为我在 git diff 输出(在你的)中禁用了文件名前缀。它们在读取输出时没有用,但显然 git 补丁依赖于它们。noprefix = true.gitconfiggit diff
noprefix = true
.gitconfig
git diff
您可以检查您的设置
git config --get diff.noprefix
如果它返回true,请尝试禁用该设置
true
git config --global diff.noprefix false
--global(如果您只想对当前回购进行更改,则可以省略标志)。
--global
之后生成的补丁对我来说效果很好。