{"id":1679,"date":"2018-09-27T15:56:49","date_gmt":"2018-09-27T07:56:49","guid":{"rendered":"https:\/\/damogame.cn:15443\/wordpress\/?p=1679"},"modified":"2018-10-25T09:54:46","modified_gmt":"2018-10-25T01:54:46","slug":"git%e4%bb%a3%e7%a0%81%e5%86%b2%e7%aa%81%e5%b8%b8%e8%a7%81%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/1679","title":{"rendered":"Git:\u4ee3\u7801\u51b2\u7a81\u5e38\u89c1\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<div class=\"postTitle\"><a id=\"cb_post_title_url\" href=\"https:\/\/www.cnblogs.com\/wuyifu\/p\/5564911.html\">Git:\u4ee3\u7801\u51b2\u7a81\u5e38\u89c1\u89e3\u51b3\u65b9\u6cd5<\/a><\/div>\n<div class=\"postText\">\n<div id=\"cnblogs_post_body\" class=\"blogpost-body cnblogs-markdown\">\n<p>\u6458\u81ea: http:\/\/blog.csdn.net\/iefreer\/article\/details\/7679631<\/p>\n<p>\u5982\u679c\u7cfb\u7edf\u4e2d\u6709\u4e00\u4e9b\u914d\u7f6e\u6587\u4ef6\u5728\u670d\u52a1\u5668\u4e0a\u505a\u4e86\u914d\u7f6e\u4fee\u6539,\u7136\u540e\u540e\u7eed\u5f00\u53d1\u53c8\u65b0\u6dfb\u52a0\u4e00\u4e9b\u914d\u7f6e\u9879\u7684\u65f6\u5019,<\/p>\n<p>\u5728\u53d1\u5e03\u8fd9\u4e2a\u914d\u7f6e\u6587\u4ef6\u7684\u65f6\u5019,\u4f1a\u53d1\u751f\u4ee3\u7801\u51b2\u7a81:<\/p>\n<p>error: Your local changes to the following files would be overwritten by merge:<br \/>\nprotected\/config\/main.php<br \/>\nPlease, commit your changes or stash them before you can merge.<\/p>\n<p>\u5982\u679c\u5e0c\u671b\u4fdd\u7559\u751f\u4ea7\u670d\u52a1\u5668\u4e0a\u6240\u505a\u7684\u6539\u52a8,\u4ec5\u4ec5\u5e76\u5165\u65b0\u914d\u7f6e\u9879, \u5904\u7406\u65b9\u6cd5\u5982\u4e0b:<\/p>\n<p>git stash<br \/>\ngit pull<br \/>\ngit stash pop<br \/>\n\u7136\u540e\u53ef\u4ee5\u4f7f\u7528git diff -w +\u6587\u4ef6\u540d \u6765\u786e\u8ba4\u4ee3\u7801\u81ea\u52a8\u5408\u5e76\u7684\u60c5\u51b5.<\/p>\n<p>\u53cd\u8fc7\u6765,\u5982\u679c\u5e0c\u671b\u7528\u4ee3\u7801\u5e93\u4e2d\u7684\u6587\u4ef6\u5b8c\u5168\u8986\u76d6\u672c\u5730\u5de5\u4f5c\u7248\u672c. \u65b9\u6cd5\u5982\u4e0b:<\/p>\n<p>git reset &#8211;hard<br \/>\ngit pull<br \/>\n\u5176\u4e2dgit reset\u662f\u9488\u5bf9\u7248\u672c,\u5982\u679c\u60f3\u9488\u5bf9\u6587\u4ef6\u56de\u9000\u672c\u5730\u4fee\u6539,\u4f7f\u7528<\/p>\n<p>git checkout HEAD file\/to\/restore<\/p>\n<hr \/>\n<p>\u6458\u81ea: http:\/\/zhidao.baidu.com\/link?url=mRIczQrWwKb4tCcHaLwLGzjHcfqTvUAEyB1n-ayPSyVerNC0UAUgrJC7-tVI4iQT-Yr_g7vAMHKnhYXZ3MsGu-xrE5JBB3mjnh1Q2U3nD2O<\/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<br \/>\n1\u3001\u5148\u5c06\u672c\u5730\u4fee\u6539\u5b58\u50a8\u8d77\u6765<br \/>\n$ git stash<\/p>\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>git stash\u6682\u5b58\u4fee\u6539<br \/>\n\u5176\u4e2dstash@{0}\u5c31\u662f\u521a\u624d\u4fdd\u5b58\u7684\u6807\u8bb0\u3002<br \/>\n2\u3001pull\u5185\u5bb9<br \/>\n\u6682\u5b58\u4e86\u672c\u5730\u4fee\u6539\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5pull\u4e86\u3002<br \/>\n$ git pull<\/p>\n<p>3\u3001\u8fd8\u539f\u6682\u5b58\u7684\u5185\u5bb9<br \/>\n$ git stash pop stash@{0}<\/p>\n<p>\u7cfb\u7edf\u63d0\u793a\u5982\u4e0b\u7c7b\u4f3c\u7684\u4fe1\u606f\uff1a<br \/>\nAuto-merging c\/environ.c<br \/>\nCONFLICT (content): Merge conflict in c\/environ.c<\/p>\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<br \/>\n4\u3001\u89e3\u51b3\u6587\u4ef6\u4e2d\u51b2\u7a81\u7684\u7684\u90e8\u5206<br \/>\n\u6253\u5f00\u51b2\u7a81\u7684\u6587\u4ef6\uff0c\u4f1a\u770b\u5230\u7c7b\u4f3c\u5982\u4e0b\u7684\u5185\u5bb9\uff1a<\/p>\n<p>git\u51b2\u7a81\u5185\u5bb9<\/p>\n<p>\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>\u89e3\u51b3\u5b8c\u6210\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u6b63\u5e38\u7684\u63d0\u4ea4\u4e86\u3002<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Git:\u4ee3\u7801\u51b2\u7a81\u5e38\u89c1\u89e3\u51b3\u65b9\u6cd5 \u6458\u81ea: h<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[119],"class_list":["post-1679","post","type-post","status-publish","format-standard","hentry","tag-03-"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/1679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=1679"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/1679\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=1679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=1679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=1679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}