2
我想将补丁应用到当前目录中的文件。修补程序文件中的路径仅显示/ FILETOPATCH.something b/FILETOPATCH.something。如果我在git中使用它,它不起作用。要修补的文件和.patch文件位于相同的目录中。为什么git不会在当前目录中找到要修补的文件?
我尝试了许多变体中的--directory和-p选项,但没有成功。
使用patch -p1 < patchfile.patch工作正常。
如果我从.patch文件中的存储库根目录设置绝对路径,它也适用于git apply,但肯定有一种方法无需编辑补丁文件。
这将git的工作申请
diff --git a/htdocs/something/whatever/file.code b/htdocs/something/whatever/file.code
index 385f3f4..07d8062 100644
--- a/htdocs/something/whatever/file.code
+++ b/htdocs/something/whatever/file.code
...
PATCH DATA
...
但不是这个(这是原件)
diff --git a/file.code b/file.code
index 385f3f4..07d8062 100644
--- a/file.code
+++ b/file.code
...
PATCH DATA
...
任何想法如何获得git的申请工作,而不改变补丁文件?