{"id":5070,"date":"2020-08-11T09:52:34","date_gmt":"2020-08-11T01:52:34","guid":{"rendered":"https:\/\/www.xttblog.com\/?p=5070"},"modified":"2020-08-11T09:52:34","modified_gmt":"2020-08-11T01:52:34","slug":"git-stash%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=5070","title":{"rendered":"git stash\u5e38\u7528\u547d\u4ee4\u603b\u7ed3"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u6709\u540c\u4e8b\u559c\u6b22\u4f7f\u7528\u56fe\u5f62\u5de5\u5177\uff0c\u800c\u6211\u6709\u65f6\u5019\u4f7f\u7528\u547d\u4ee4\u884c\u3002\u4f7f\u7528\u56fe\u5f62\u5316\u5de5\u5177\u7684\u5f80\u5f80\u4f1a\u5fd8\u8bb0\u4e86\u5177\u4f53\u7684\u547d\u4ee4\uff0c\u6240\u4ee5\u5728\u7f51\u53cb\u79c1\u4fe1\u6211\u7684\u65f6\u5019\uff0c\u6211\u968f\u624b\u7ed9\u4ed6\u603b\u7ed3\u4e86\u4e00\u4e2a\u547d\u4ee4\uff0c\u672c\u6587\u5728\u8fd9\u91cc\u6458\u5f55\u4e00\u4e0b\uff0c\u65b9\u4fbf\u540e\u7eed\u7f51\u53cb\u5b66\u4e60\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5e38\u7528 git stash \u547d\u4ee4\u603b\u7ed3\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>git stash save &#8220;save message&#8221;  : \u6267\u884c\u5b58\u50a8\u65f6\uff0c\u6dfb\u52a0\u5907\u6ce8\uff0c\u65b9\u4fbf\u67e5\u627e\uff0c\u53ea\u6709git stash \u4e5f\u8981\u53ef\u4ee5\u7684\uff0c\u4f46\u67e5\u627e\u65f6\u4e0d\u65b9\u4fbf\u8bc6\u522b\u3002<\/li><li>git stash list  \uff1a\u67e5\u770bstash\u4e86\u54ea\u4e9b\u5b58\u50a8<\/li><li>git stash show \uff1a\u663e\u793a\u505a\u4e86\u54ea\u4e9b\u6539\u52a8\uff0c\u9ed8\u8ba4show\u7b2c\u4e00\u4e2a\u5b58\u50a8,\u5982\u679c\u8981\u663e\u793a\u5176\u4ed6\u5b58\u8d2e\uff0c\u540e\u9762\u52a0stash@{$num}\uff0c\u6bd4\u5982\u7b2c\u4e8c\u4e2a git stash show stash@{1}<\/li><li>git stash show -p : \u663e\u793a\u7b2c\u4e00\u4e2a\u5b58\u50a8\u7684\u6539\u52a8\uff0c\u5982\u679c\u60f3\u663e\u793a\u5176\u4ed6\u5b58\u5b58\u50a8\uff0c\u547d\u4ee4\uff1agit stash show  stash@{$num}  -p \uff0c\u6bd4\u5982\u7b2c\u4e8c\u4e2a\uff1agit stash show  stash@{1}  -p<\/li><li>git stash apply :\u5e94\u7528\u67d0\u4e2a\u5b58\u50a8,\u4f46\u4e0d\u4f1a\u628a\u5b58\u50a8\u4ece\u5b58\u50a8\u5217\u8868\u4e2d\u5220\u9664\uff0c\u9ed8\u8ba4\u4f7f\u7528\u7b2c\u4e00\u4e2a\u5b58\u50a8,\u5373stash@{0}\uff0c\u5982\u679c\u8981\u4f7f\u7528\u5176\u4ed6\u4e2a\uff0cgit stash apply stash@{$num} \uff0c \u6bd4\u5982\u7b2c\u4e8c\u4e2a\uff1agit stash apply stash@{1} <\/li><li>git stash pop \uff1a\u547d\u4ee4\u6062\u590d\u4e4b\u524d\u7f13\u5b58\u7684\u5de5\u4f5c\u76ee\u5f55\uff0c\u5c06\u7f13\u5b58\u5806\u6808\u4e2d\u7684\u5bf9\u5e94stash\u5220\u9664\uff0c\u5e76\u5c06\u5bf9\u5e94\u4fee\u6539\u5e94\u7528\u5230\u5f53\u524d\u7684\u5de5\u4f5c\u76ee\u5f55\u4e0b,\u9ed8\u8ba4\u4e3a\u7b2c\u4e00\u4e2astash,\u5373stash@{0}\uff0c\u5982\u679c\u8981\u5e94\u7528\u5e76\u5220\u9664\u5176\u4ed6stash\uff0c\u547d\u4ee4\uff1agit stash pop stash@{$num} \uff0c\u6bd4\u5982\u5e94\u7528\u5e76\u5220\u9664\u7b2c\u4e8c\u4e2a\uff1agit stash pop stash@{1}<\/li><li>git stash drop stash@{$num} \uff1a\u4e22\u5f03stash@{$num}\u5b58\u50a8\uff0c\u4ece\u5217\u8868\u4e2d\u5220\u9664\u8fd9\u4e2a\u5b58\u50a8<\/li><li>git stash clear \uff1a\u5220\u9664\u6240\u6709\u7f13\u5b58\u7684stash<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5bf9\u4e8e\u65b0\u589e\u7684\u6587\u4ef6\uff0c\u76f4\u63a5\u6267\u884c git stash save \u662f\u4e0d\u4f1a\u88ab\u5b58\u50a8\u7684\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u73a9\u8fc7 git \u7684\u90fd\u5e94\u8be5\u77e5\u9053\uff0c\u6267\u884c\u4e86git statsh save \u4ee5\u540e\uff0c\u88ab\u5b58\u8d77\u6765\u7684\u6587\u4ef6\u5728\u5f53\u524d\u76ee\u5f55\u518d\u6267\u884c git status \u5c31\u770b\u4e0d\u5230\u4e86\uff0c\u4f46\u662f\u5bf9\u4e8e\u65b0\u589e\u7684\u6587\u4ef6\u518d\u6267\u884c git status\uff0c\u4f60\u4f1a\u53d1\u73b0\uff0c\u5b83\u8fd8\u5728\u5f53\u524d\u76ee\u5f55\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u603b\u7ed3\u4e00\u4e0b\uff0c\u5c31\u662f\u6ca1\u6709\u5728 git \u7248\u672c\u63a7\u5236\u4e2d\u7684\u6587\u4ef6\uff0c\u662f\u4e0d\u80fd\u88ab git stash save \u5b58\u8d77\u6765\u7684\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u90a3\u4e48\u9488\u5bf9\u65b0\u589e\u7684\u6587\u4ef6\u8be5\u600e\u6837\u64cd\u4f5c\u624d\u80fd\u8ba9 git stash save \u7ed9\u5b58\u8d77\u6765\u5462\uff1f\u5f88\u660e\u663e\uff0c\u5148\u6267\u884c\u4e0b git add \u52a0\u5230 git \u7248\u672c\u63a7\u5236\u4e2d\uff0c\u7136\u540e\u518d git stash save \u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b9e\u9645\u4e0a\uff0cgit add \u53ea\u662f\u628a\u6587\u4ef6\u52a0\u5230 git \u7248\u672c\u63a7\u5236\u91cc\uff0c\u5e76\u4e0d\u7b49\u4e8e\u5c31\u88ab stash \u8d77\u6765\u4e86\uff0cgit add \u548c git stash \u6ca1\u6709\u5fc5\u7136\u7684\u5173\u7cfb\uff0c\u4f46\u662f\u6267\u884c git stash \u80fd\u6b63\u786e\u5b58\u50a8\u7684\u524d\u63d0\u662f\u6587\u4ef6\u5fc5\u987b\u5728 git \u7248\u672c\u63a7\u5236\u4e2d\u624d\u884c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f46\u662f\uff0c\u53c8\u6709\u7f51\u53cb\u8bf4\u4e86\uff0c\u5982\u679c\u6211\u53ea\u60f3\u5907\u4efd\u4e00\u4e0b\uff0c\u6ca1\u6709\u88ab git add \u7684\u6587\u4ef6\uff0c\u8be5\u600e\u4e48\u529e\uff1f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f60\u60f3\u5230\u7684\uff0cgit \u4e5f\u60f3\u5230\u4e86\uff0c\u53ea\u662f\u64cd\u4f5c\u9ebb\u70e6\u4e00\u4e0b\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5148 git add \u5907\u4efd\u7684\u6587\u4ef6\uff0c\u7136\u540e\u6267\u884c git stash \u2013keep-index \u5907\u4efd\u90a3\u4e9b\u6ca1\u6709\u88ab add \u7684\u6587\u4ef6\uff0c\u6700\u540e\u518d\u6267\u884c git reset \u53d6\u6d88\u5df2\u7ecf add \u7684\u6587\u4ef6\u7684\u5907\u4efd\uff01<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=5070\">git stash\u5e38\u7528\u547d\u4ee4\u603b\u7ed3<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u6709\u540c\u4e8b\u559c\u6b22\u4f7f\u7528\u56fe\u5f62\u5de5\u5177\uff0c\u800c\u6211\u6709\u65f6\u5019\u4f7f\u7528\u547d\u4ee4\u884c\u3002\u4f7f\u7528\u56fe\u5f62\u5316\u5de5\u5177\u7684\u5f80\u5f80\u4f1a\u5fd8\u8bb0\u4e86\u5177\u4f53\u7684\u547d\u4ee4\uff0c\u6240\u4ee5\u5728\u7f51\u53cb\u79c1\u4fe1\u6211\u7684\u65f6\u5019\uff0c [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[118],"tags":[1438,1460,1639,1437,1458],"class_list":["post-5070","post","type-post","status-publish","format-standard","hentry","category-ndisdevelop","tag-git","tag-git-","tag-gitalk","tag-github"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5070","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5070"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5070\/revisions"}],"predecessor-version":[{"id":5071,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5070\/revisions\/5071"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5070"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5070"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}