tldr:为什么我error: ... patch does not apply
在编辑一个大块并删除一行时会得到,即使它看起来应该可以工作?
我正在编辑一个大块git add -p
,我只想添加new line 1
(而不是添加new line 2
):
# Manual hunk edit mode -- see bottom for a quick guide
@@ -1 +1,3 @@
first line
+new line 1
+new line 2
# ---
# To remove '-' lines, make them ' ' lines (context).
# To remove '+' lines, delete them.
# Lines starting with # will be removed.
我将 更改为+
空格:
new line 2
# Manual hunk edit mode -- see bottom for a quick guide
@@ -1 +1,3 @@
first line
+new line 1
new line 2
# ---
# To remove '-' lines, make them ' ' lines (context).
# To remove '+' lines, delete them.
# Lines starting with # will be removed.
但这给出了错误:
error: patch failed: myfile:1
error: myfile: patch does not apply
Your edited hunk does not apply. Edit again (saying "no" discards!) [y/n]?
问题是什么?