{"id":7634,"date":"2016-01-05T13:21:53","date_gmt":"2016-01-05T05:21:53","guid":{"rendered":"http:\/\/jpuyy.com\/?p=7634"},"modified":"2016-01-05T13:21:53","modified_gmt":"2016-01-05T05:21:53","slug":"git-patch-%e7%9a%84%e5%ba%94%e7%94%a8","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=7634","title":{"rendered":"git patch \u7684\u5e94\u7528"},"content":{"rendered":"<p>\u6839\u636e\u63d0\u4ea4\u6765\u521b\u5efa patch\uff0c\u5e76\u628a\u521b\u5efa\u7684 patch \u5e94\u7528\u5230\u5176\u4ed6 repo \u4e0a<\/p>\n<p>\u5f53\u8981\u4fee\u8865\u4e00\u4e2a bug \u6216\u5f00\u53d1\u65b0\u7279\u6027\uff0c\u65b0\u521b\u5efa\u4e00\u4e2a\u5206\u652f<\/p>\n<pre>git checkout -b fix<\/pre>\n<p>\u5728\u505a\u4e86\u4e00\u4e9b\u63d0\u4ea4\u4e4b\u540e\uff0c\u57fa\u4e8e master \u8f93\u51fa\u4e00\u4e2a patch<\/p>\n<pre>git format-patch master --stdout > fix.patch<\/pre>\n<p>\u63a5\u4e0b\u6765\u628a patch \u6587\u4ef6\u641e\u5230\u5176\u4ed6 repo \u4e2d<\/p>\n<p>\u67e5\u770b\u6b64 patch \u6709\u54ea\u4e9b\u6539\u53d8<\/p>\n<pre>git apply --stat fix.patch<\/pre>\n<p>\u6d4b\u8bd5\u662f\u4e0d\u662f\u53ef\u4ee5\u5e94\u7528 patch \u4e0a\u53bb<\/p>\n<pre>git apply --check  fix.patch<\/pre>\n<p>\u5982\u679c\u6ca1\u6709\u62a5\u9519\uff0c\u53ef\u4ee5\u8fdb\u884c\u4e0b\u4e00\u6b65\uff0c\u5e94\u7528 patch<\/p>\n<pre>git am --signoff < fix.patch<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6839\u636e\u63d0\u4ea4\u6765\u521b\u5efa patch\uff0c\u5e76\u628a\u521b\u5efa\u7684 patch \u5e94\u7528\u5230\u5176\u4ed6 repo \u4e0a \u5f53\u8981\u4fee\u8865\u4e00\u4e2a bug \u6216\u5f00\u53d1\u65b0\u7279\u6027\uff0c\u65b0\u521b\u5efa\u4e00\u4e2a\u5206\u652f git checkout -b fix \u5728\u505a\u4e86\u4e00\u4e9b\u63d0\u4ea4\u4e4b\u540e\uff0c\u57fa\u4e8e master \u8f93\u51fa\u4e00\u4e2a patch git format-patch master &#8211;stdout > fix.patch \u63a5\u4e0b\u6765\u628a patch \u6587\u4ef6\u641e\u5230\u5176\u4ed6 repo \u4e2d \u67e5\u770b\u6b64 patch \u6709\u54ea\u4e9b\u6539\u53d8 git apply &#8211;stat fix.patch \u6d4b\u8bd5\u662f\u4e0d\u662f\u53ef\u4ee5\u5e94\u7528 patch \u4e0a\u53bb git apply &#8211;check fix.patch \u5982\u679c\u6ca1\u6709\u62a5\u9519\uff0c\u53ef\u4ee5\u8fdb\u884c\u4e0b\u4e00\u6b65\uff0c\u5e94\u7528 patch git am &#8211;signoff < fix.patch\n<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[168],"tags":[],"class_list":["post-7634","post","type-post","status-publish","format-standard","hentry","category-git"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7634"}],"version-history":[{"count":1,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7634\/revisions"}],"predecessor-version":[{"id":7635,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7634\/revisions\/7635"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}