我正在以交互方式添加文件:
git add ../../template/panels/panel-reports.php -p
diff --git a/template/panels/panel-reports.php b/template/panels/panel-reports.php
index 5482228..48d2901 100644
--- a/template/panels/panel-reports.php
+++ b/template/panels/panel-reports.php
@@ -214,6 +214,8 @@
<a class="addCategory"></a>
<a class="removeCategory"></a>
+ <a class="addDocument"></a>
+ <a class="checkTool"></a>
<div class="categoriesList"></div>
<div class="documentsList"></div>
Stage this hunk [y,n,q,a,d,/,e,?]? e
Run Code Online (Sandbox Code Playgroud)
ps:这些是这里唯一的修改过的行
我想删除
+ <a class="checkTool"></a>
Run Code Online (Sandbox Code Playgroud)
所以我这样编辑:
# Manual hunk edit mode -- see bottom for a quick guide
@@ -214,6 +214,7 @@
<a class="addCategory"></a>
<a class="removeCategory"></a>
+ <a class="addDocument"></a>
<div class="categoriesList"></div>
<div class="documentsList"></div>
# ---
# To remove '-' lines, make them ' ' lines (context).
# To remove '+' lines, delete them.
# Lines starting with # will be removed.
Run Code Online (Sandbox Code Playgroud)
并且git拒绝了它:
error: patch failed: template/panels/panel-reports.php:214
error: template/panels/panel-reports.php: patch does not apply
Your edited hunk does not apply. Edit again (saying "no" discards!) [y/n]?
Run Code Online (Sandbox Code Playgroud)
对我来说,我没有看到我写的任何错误或含糊之处,所以我错在哪里?
ant*_*tho 11
ydroneaud的评论是我正在寻找的答案.
许多文本编辑在保存时剪切了尾随的空格,请注意这一点.
第二件事,当删除" - "以保持一条线时,实际上用空格""替换它,不要只删除它.
最后,不要在顶部的@@ @@中输入数字.