【发布时间】:2022-01-13 15:20:06
【问题描述】:
我有 3 个文件 a\test.txt、b\test.txt 和 c\test.txt:
a\test.txt:
x
y
z
b\test.txt:
x
z
p
q
c\test.txt:
x
y
现在我在 a 和 b 之间创建了一个补丁:
git diff --no-prefix --binary a b > mypatch.patch
导致这个补丁:
diff --git a/test.txt b/test.txt
index 1b2c8f8..e0b3aec 100644
--- a/test.txt
+++ b/test.txt
@@ -1,3 +1,4 @@
x
-y
-z
\ No newline at end of file
+z
+p
+q
\ No newline at end of file
接下来我想在c\test.txt上应用mypatch.patch:
cd c:\
git apply --ignore-space-change --ignore-whitespace ../mypatch.patch
我得到错误:
../mypatch.patch:10: trailing whitespace.
z
../mypatch.patch:11: trailing whitespace.
p
error: patch failed: test.txt:1
error: test.txt: patch does not apply
我在这里阅读了很多关于 SO 的帖子,但仍然没有设法将其应用到任何想法?
我在 mypatch.patch 中没有看到任何尾随空格
【问题讨论】:
标签: git