{"id":8262,"date":"2020-10-12T10:40:29","date_gmt":"2020-10-12T02:40:29","guid":{"rendered":"https:\/\/sdeno.com\/?p=8262"},"modified":"2020-10-12T10:40:59","modified_gmt":"2020-10-12T02:40:59","slug":"%e8%a7%a3%e5%86%b3git-pull%e6%97%b6%e9%81%87%e5%88%b0error-cannot-lock-ref-xxx-ref-xxx-is-at-%ef%bc%88%e4%b8%80%e4%b8%aacommitid%ef%bc%89-but-expected","status":"publish","type":"post","link":"https:\/\/sdeno.com\/?p=8262","title":{"rendered":"\u89e3\u51b3git pull\u65f6\u9047\u5230error: cannot lock ref \u2018xxx\u2019: ref xxx is at \uff08\u4e00\u4e2acommitID\uff09 but expected"},"content":{"rendered":"<p>\u5728\u6267\u884cgit pull\u65f6\u9047\u5230\u5982\u4e0b\u9519\u8bef\uff1a<\/p>\n<pre>error: cannot lock ref 'xxx': ref xxx is at \uff08\u4e00\u4e2acommitID\uff09 but expected<\/pre>\n<p>&nbsp;<\/p>\n<p>\u539f\u56e0\uff1a<br \/>\n\u539f\u56e0\u662f\u4f60\u8fd9\u4e2agit\u5de5\u7a0b\u7684.git\/refs\u76ee\u5f55\u4e0b\u8ddf\u8e2a\u7684\u67d0\u4e9bgit\u5206\u652f\uff0c\u5728git pull\u7684\u65f6\u5019\uff0c\u4e0e\u8fdc\u7aef\u7684\u5bf9\u5e94\u5206\u652f\u7684refs\u5bf9\u6bd4\u53d1\u73b0\u4e0d\u540c\uff0c\u6240\u4ee5\u5bfc\u81f4git pull\u62a5\u9519\u3002<\/p>\n<p>\u901a\u5e38\u4ea7\u751f\u8fd9\u4e2a\u95ee\u9898\u7684\u539f\u56e0\u662f\uff08\u4ee5\u5206\u652fgit\/yousa\/feature_01\u4e3a\u4f8b\uff09\uff1a<\/p>\n<ol>\n<li>\u6709\u4eba\u64cd\u4f5cgit\/yousa\/feature_01\u8fd9\u4e2a\u5206\u652f\uff0c\u5728git push\u7684\u65f6\u5019\u4f7f\u7528\u4e86git push \u2013force\uff0c\uff08\u5f53\u7136\u8fd9\u4e2a\u4eba\u7684git push\u662fpush\u4e0d\u4e0a\u53bb\uff09\uff0c\u5bfc\u81f4\u8fdc\u7aef\u5206\u652f\u88ab\u8986\u76d6\uff0c\u4f60\u672c\u5730\u7684refs\u4e0e\u8fdc\u7aef\u65e0\u6cd5\u4e00\u81f4\uff0c\u5bfc\u81f4\u95ee\u9898<\/li>\n<li>git\u5206\u652f\u662f\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\uff0c\u5982\u679c\u6709\u4eba\u5220\u9664\u6389\u8fd9\u4e2a\u8fdc\u7aef\u5206\u652f\u53c8\u91cd\u65b0\u65b0\u5efa\u4e86\u4e00\u4e2a\u8fd9\u4e2a\u5206\u652f\u4e5f\u4f1a\u51fa\u73b0\u540c\u6837\u7684\u95ee\u9898\u3002<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>\u89e3\u51b3\uff1a<\/p>\n<p>\u6839\u636e\u524d\u9762\u7684\u539f\u56e0\u6709\u4e00\u4e9b\u64cd\u4f5c\u65b9\u6cd5\uff0c\u57fa\u672c\u601d\u8def\u5c31\u662f\u8981\u4e48\uff0c\u5f3a\u884cgit pull\uff1b\u8981\u4e48\u5219\u662f\u5220\u9664\u6389\u6709\u95ee\u9898\u7684refs\uff0c\u518d\u8fdb\u884cgit pull\uff08\u4e2a\u4eba\u8fd8\u662f\u63a8\u8350\u7b2c\u4e8c\u79cd\uff09\uff08\u4ee5\u5206\u652fgit\/yousa\/feature_01\u4e3a\u4f8b\uff09<\/p>\n<ol>\n<li>\u5220\u9664\u6709\u95ee\u9898\u7684refs\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728.git\/refs\u4e0b\u9762\u6839\u636e\u9519\u8bef\u63d0\u793a\u5220\u9664\u5bf9\u5e94\u7684refs\u6587\u4ef6\uff0c\u6bd4\u5982\u8fd9\u4e2a\u5c31\u662f\u9700\u8981\u5220\u9664refs\/remotes\/origin\/git\/yousa\/feature_01\u6587\u4ef6\uff08\u5acc\u9ebb\u70e6\u76f4\u63a5\u5220\u9664\u6574\u4e2arefs\u76ee\u5f55\u4e5f\u884c\uff09<\/li>\n<li>\u4f7f\u7528git\u547d\u4ee4\u5220\u9664\u76f8\u5e94refs\u6587\u4ef6\uff0c<code>git update-ref -d refs\/remotes\/origin\/git\/yousa\/feature_01<\/code><\/li>\n<li>\u7b80\u5355\u7c97\u66b4\u5f3a\u884cgit pull\uff0c\u6267\u884c<code>git pull -p<\/code><\/li>\n<\/ol>\n<p><a href=\"https:\/\/blog.csdn.net\/qq_15437667\/article\/details\/52479792\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/qq_15437667\/article\/details\/52479792<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u6267\u884cgit pull\u65f6\u9047\u5230\u5982\u4e0b\u9519\u8bef\uff1a error: cannot lock ref &#8216;xxx&#8217;: ref x [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,9],"tags":[],"class_list":["post-8262","post","type-post","status-publish","format-standard","hentry","category-11","category-9"],"_links":{"self":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/8262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8262"}],"version-history":[{"count":0,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/8262\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}