{"id":4085,"date":"2014-04-23T00:16:09","date_gmt":"2014-04-22T16:16:09","guid":{"rendered":"https:\/\/www.icocean.com\/blog\/?p=4085"},"modified":"2014-04-23T00:16:11","modified_gmt":"2014-04-22T16:16:11","slug":"%e4%bd%bf%e7%94%a8git-pull%e6%96%87%e4%bb%b6%e6%97%b6%e5%92%8c%e6%9c%ac%e5%9c%b0%e6%96%87%e4%bb%b6%e5%86%b2%e7%aa%81%e6%80%8e%e4%b9%88%e5%8a%9e%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.icocean.com\/blog\/?p=4085","title":{"rendered":"\u4f7f\u7528git pull\u6587\u4ef6\u65f6\u548c\u672c\u5730\u6587\u4ef6\u51b2\u7a81\u600e\u4e48\u529e\uff1f"},"content":{"rendered":"<p>\u540c\u4e8b\u5728\u4f7f\u7528git pull\u4ee3\u7801\u65f6\uff0c\u7ecf\u5e38\u4f1a\u78b0\u5230\u6709\u51b2\u7a81\u7684\u60c5\u51b5\uff0c\u63d0\u793a\u5982\u4e0b\u4fe1\u606f\uff1a<\/p>\n<pre>error: Your local changes to 'c\/environ.c' would be overwritten by merge.  Aborting.\r\nPlease, commit your changes or stash them before you can merge.<\/pre>\n<p>\u8fd9\u4e2a\u610f\u601d\u662f\u8bf4\u66f4\u65b0\u4e0b\u6765\u7684\u5185\u5bb9\u548c\u672c\u5730\u4fee\u6539\u7684\u5185\u5bb9\u6709\u51b2\u7a81\uff0c\u5148\u63d0\u4ea4\u4f60\u7684\u6539\u53d8\u6216\u8005\u5148\u5c06\u672c\u5730\u4fee\u6539\u6682\u65f6\u5b58\u50a8\u8d77\u6765\u3002<\/p>\n<p>\u5904\u7406\u7684\u65b9\u5f0f\u975e\u5e38\u7b80\u5355\uff0c\u4e3b\u8981\u662f\u4f7f\u7528git stash\u547d\u4ee4\u8fdb\u884c\u5904\u7406\uff0c\u5206\u6210\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\u8fdb\u884c\u5904\u7406\u3002<!--more--><\/p>\n<p><strong>1\u3001\u5148\u5c06\u672c\u5730\u4fee\u6539\u5b58\u50a8\u8d77\u6765<\/strong><\/p>\n<pre>$ git stash<\/pre>\n<p>\u8fd9\u6837\u672c\u5730\u7684\u6240\u6709\u4fee\u6539\u5c31\u90fd\u88ab\u6682\u65f6\u5b58\u50a8\u8d77\u6765 \u3002\u662f\u7528git stash list\u53ef\u4ee5\u770b\u5230\u4fdd\u5b58\u7684\u4fe1\u606f\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1739\" title=\"git stash\u6682\u5b58\u4fee\u6539\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2014\/04\/161610KsU.png\" alt=\"git stash\u6682\u5b58\u4fee\u6539\" width=\"407\" height=\"23\" \/><\/p>\n<p>\u5176\u4e2dstash@{0}\u5c31\u662f\u521a\u624d\u4fdd\u5b58\u7684\u6807\u8bb0\u3002<\/p>\n<p><strong>2\u3001pull\u5185\u5bb9<\/strong><\/p>\n<p>\u6682\u5b58\u4e86\u672c\u5730\u4fee\u6539\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5pull\u4e86\u3002<\/p>\n<pre>$ git pull<\/pre>\n<p><strong>3\u3001\u8fd8\u539f\u6682\u5b58\u7684\u5185\u5bb9<\/strong><\/p>\n<pre>$ git stash pop stash@{0}<\/pre>\n<p>\u7cfb\u7edf\u63d0\u793a\u5982\u4e0b\u7c7b\u4f3c\u7684\u4fe1\u606f\uff1a<\/p>\n<pre>Auto-merging c\/environ.c\r\nCONFLICT (content): Merge conflict in c\/environ.c<\/pre>\n<p>\u610f\u601d\u5c31\u662f\u7cfb\u7edf\u81ea\u52a8\u5408\u5e76\u4fee\u6539\u7684\u5185\u5bb9\uff0c\u4f46\u662f\u5176\u4e2d\u6709\u51b2\u7a81\uff0c\u9700\u8981\u89e3\u51b3\u5176\u4e2d\u7684\u51b2\u7a81\u3002<\/p>\n<p><strong>4\u3001\u89e3\u51b3\u6587\u4ef6\u4e2d\u51b2\u7a81\u7684\u7684\u90e8\u5206<\/strong><\/p>\n<p>\u6253\u5f00\u51b2\u7a81\u7684\u6587\u4ef6\uff0c\u4f1a\u770b\u5230\u7c7b\u4f3c\u5982\u4e0b\u7684\u5185\u5bb9\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1740\" title=\"git\u51b2\u7a81\u5185\u5bb9\" src=\"https:\/\/www.icocean.com\/blog\/wp-content\/uploads\/auto_save_image\/2014\/04\/161611tl8.png\" alt=\"git\u51b2\u7a81\u5185\u5bb9\" width=\"241\" height=\"79\" \/><br \/>\n\u5176\u4e2dUpdated upstream \u548c=====\u4e4b\u95f4\u7684\u5185\u5bb9\u5c31\u662fpull\u4e0b\u6765\u7684\u5185\u5bb9\uff0c====\u548cstashed changes\u4e4b\u95f4\u7684\u5185\u5bb9\u5c31\u662f\u672c\u5730\u4fee\u6539\u7684\u5185\u5bb9\u3002\u78b0\u5230\u8fd9\u79cd\u60c5\u51b5\uff0cgit\u4e5f\u4e0d\u77e5\u9053\u54ea\u884c\u5185\u5bb9\u662f\u9700\u8981\u7684\uff0c\u6240\u4ee5\u8981\u81ea\u884c\u786e\u5b9a\u9700\u8981\u7684\u5185\u5bb9\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u89e3\u51b3\u5b8c\u6210\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u6b63\u5e38\u7684\u63d0\u4ea4\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u540c\u4e8b\u5728\u4f7f\u7528git pull\u4ee3\u7801\u65f6\uff0c\u7ecf\u5e38\u4f1a\u78b0\u5230\u6709\u51b2\u7a81\u7684\u60c5\u51b5\uff0c\u63d0\u793a\u5982\u4e0b\u4fe1\u606f\uff1a error: Your local  <a href='https:\/\/www.icocean.com\/blog\/?p=4085' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[3939],"class_list":["post-4085","post","type-post","status-publish","format-standard","hentry","category-4","tag-git","category-4-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4085","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4085"}],"version-history":[{"count":1,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4085\/revisions"}],"predecessor-version":[{"id":4088,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4085\/revisions\/4088"}],"wp:attachment":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}