我正在以交互方式添加文件:
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
ps:这是唯一修改的行
我想删除
+ <a class="checkTool"></a>
所以我这样编辑:
# 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.
并且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]?
对我来说,我没有看到我写的内容有任何错误或含糊之处,所以我错在哪里?
答案 0 :(得分:11)
许多文本编辑在保存时会剪切尾随空格,请注意这一点。
第二件事,当删除&#34; - &#34;保持一条线,实际上用空格替换它&#34; &#34;,不要删除它。
最后,不要在@@ @@顶部摆弄数字。