同事 git format 生成的patch,使用 git am 打patch遇到如下问题:
x
➜ git am 0001-bug_fix-ISSUE-790-Fix-disconnect.patch
Applying: Fix disconnect
error: patch failed: package/apps/ap_manage/src/ap_manage.c:533
error: package/apps/ap_manage/src/ap_manage.c: patch does not apply
Patch failed at 0001 disconnect
The copy of the patch that failed is found in:
/home/orange/ap-r30/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
先将可以正常合入的patch 打进去,然后针对错误的文件进行修改
x
➜ git am 0001-bug_fix-ISSUE-790-Fix-disconnect.patch --reject
Applying: Fix disconnect
Checking patch package/apps/ap_manage/src/ap_manage.c...
error: while searching for:
}
reload_location_config(path_location);
}
free(path);
path = NULL;
return ;
error: patch failed: package/apps/ap_manage/src/ap_manage.c:533
Hunk #5 succeeded at 824 (offset 12 lines).
Hunk #6 succeeded at 845 (offset 12 lines).
Checking patch package/apps/ap_manage/src/buffer.c...
修改patch失败的文件
xxxxxxxxxx
package/apps/ap_manage/src/ap_manage.c
添加
x
➜ git add .
git am resolved
x
➜ git am --resolved