{"id":1478,"date":"2012-04-24T18:14:11","date_gmt":"2012-04-24T10:14:11","guid":{"rendered":"http:\/\/doophp.sinaapp.com\/?p=1478"},"modified":"2012-04-24T18:19:06","modified_gmt":"2012-04-24T10:19:06","slug":"git-stash","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/other\/git-stash.html","title":{"rendered":"Git Stash\u547d\u4ee4\uff1a\u4fdd\u5b58\u5f53\u524d\u5de5\u4f5c\u533a"},"content":{"rendered":"
\u5f53\u4f60\u6b63\u5728\u505a\u4e00\u9879\u590d\u6742\u7684\u5de5\u4f5c\u65f6, \u53d1\u73b0\u4e86\u4e00\u4e2a\u548c\u5f53\u524d\u5de5\u4f5c\u4e0d\u76f8\u5173\u4f46\u662f\u53c8\u5f88\u8ba8\u538c\u7684bug. \u4f60\u8fd9\u65f6\u60f3\u5148\u4fee\u590dbug\u518d\u505a\u624b\u5934\u7684\u5de5\u4f5c, \u90a3\u4e48\u5c31\u53ef\u4ee5\u7528 git stash \u6765\u4fdd\u5b58\u5f53\u524d\u7684\u5de5\u4f5c\u72b6\u6001, \u7b49\u4f60\u4fee\u590d\u5b8cbug\u540e,\u6267\u884c’\u53cd\u50a8\u85cf'(unstash)\u64cd\u4f5c\u5c31\u53ef\u4ee5\u56de\u5230\u4e4b\u524d\u7684\u5de5\u4f5c\u91cc.<\/p>\n
git stash\u4f1a\u4fdd\u5b58\u4f60\u7684\u672c\u5730\u4fee\u6539\u5230\u50a8\u85cf(stash)\u4e2d, \u7136\u540e\u5c06\u4f60\u7684\u5de5\u4f5c\u76ee\u5f55\u548c\u7d22\u5f15\u91cc\u7684\u5185\u5bb9\u5168\u90e8\u91cd\u7f6e, \u56de\u5230\u4f60\u5f53\u524d\u6240\u5728\u5206\u652f\u7684\u4e0a\u6b21\u63d0\u4ea4\u65f6\u7684\u72b6\u6001.<\/p>\n
<\/p>\n
Git Stash\u547d\u4ee4\u7684\u7528\u6cd5:<\/strong><\/p>\n Git Stash\u9002\u7528\u573a\u666f\uff1a<\/strong><\/p>\n \u4f7f\u7528git\u7684\u65f6\u5019\uff0c\u6211\u4eec\u5f80\u5f80\u4f7f\u7528branch\u89e3\u51b3\u4efb\u52a1\u5207\u6362\u95ee\u9898\uff0c\u4f8b\u5982\uff0c\u6211\u4eec\u5f80\u5f80\u4f1a\u5efa\u4e00\u4e2a\u81ea\u5df1\u7684\u5206\u652f\u53bb\u4fee\u6539\u548c\u8c03\u8bd5\u4ee3\u7801, \u5982\u679c\u522b\u4eba\u6216\u8005\u81ea\u5df1\u53d1\u73b0\u539f\u6709\u7684\u5206\u652f\u4e0a\u6709\u4e2a\u4e0d\u5f97\u4e0d\u4fee\u6539\u7684bug\uff0c\u6211\u4eec\u5f80\u5f80\u4f1a\u628a\u5b8c\u6210\u4e00\u534a\u7684\u4ee3\u7801 commit\u63d0\u4ea4\u5230\u672c\u5730\u4ed3\u5e93\uff0c\u7136\u540e\u5207\u6362\u5206\u652f\u53bb\u4fee\u6539bug\uff0c\u6539\u597d\u4e4b\u540e\u518d\u5207\u6362\u56de\u6765\u3002\u8fd9\u6837\u7684\u8bdd\u5f80\u5f80log\u4e0a\u4f1a\u6709\u5927\u91cf\u4e0d\u5fc5\u8981\u7684\u8bb0\u5f55\u3002<\/p>\n \u5176\u5b9e\u5982\u679c\u6211\u4eec\u4e0d\u60f3\u63d0\u4ea4\u5b8c\u6210\u4e00\u534a\u6216\u8005\u4e0d\u5b8c\u5584\u7684\u4ee3\u7801\uff0c\u4f46\u662f\u5374\u4e0d\u5f97\u4e0d\u53bb\u4fee\u6539\u4e00\u4e2a\u7d27\u6025Bug\uff0c\u90a3\u4e48\u4f7f\u7528’git stash’\u5c31\u53ef\u4ee5\u5c06\u4f60\u5f53\u524d\u672a\u63d0\u4ea4\u5230\u672c\u5730\uff08\u548c\u670d\u52a1\u5668\uff09\u7684\u4ee3\u7801\u63a8\u5165\u5230Git\u7684\u6808\u4e2d\uff0c\u8fd9\u65f6\u5019\u4f60\u7684\u5de5\u4f5c\u533a\u95f4\u548c\u4e0a\u4e00\u6b21\u63d0\u4ea4\u7684\u5185\u5bb9\u662f\u5b8c\u5168\u4e00\u6837\u7684\uff0c\u6240\u4ee5\u4f60\u53ef\u4ee5\u653e\u5fc3\u7684\u4fee Bug\uff0c\u7b49\u5230\u4fee\u5b8cBug\uff0c\u63d0\u4ea4\u5230\u670d\u52a1\u5668\u4e0a\u540e\uff0c\u518d\u4f7f\u7528’git stash apply’\u5c06\u4ee5\u524d\u4e00\u534a\u7684\u5de5\u4f5c\u5e94\u7528\u56de\u6765\u3002<\/p>\n \u4e5f\u8bb8\u6709\u7684\u4eba\u4f1a\u8bf4\uff0c\u90a3\u6211\u53ef\u4e0d\u53ef\u4ee5\u591a\u6b21\u5c06\u672a\u63d0\u4ea4\u7684\u4ee3\u7801\u538b\u5165\u5230\u6808\u4e2d\uff1f\u7b54\u6848\u662f\u53ef\u4ee5\u7684\u3002\u5f53\u4f60\u591a\u6b21\u4f7f\u7528’git stash’\u547d\u4ee4\u540e\uff0c\u4f60\u7684\u6808\u91cc\u5c06\u5145\u6ee1\u4e86\u672a\u63d0\u4ea4\u7684\u4ee3\u7801\uff0c\u8fd9\u65f6\u5019\u4f60\u4f1a\u5bf9\u5c06\u54ea\u4e2a\u7248\u672c\u5e94\u7528\u56de\u6765\u6709\u4e9b\u56f0\u60d1\uff0c’git stash list’\u547d\u4ee4\u53ef\u4ee5\u5c06\u5f53\u524d\u7684Git\u6808\u4fe1\u606f\u6253\u5370\u51fa\u6765\uff0c\u4f60\u53ea\u9700\u8981\u5c06\u627e\u5230\u5bf9\u5e94\u7684\u7248\u672c\u53f7\uff0c\u4f8b\u5982\u4f7f\u7528’git stash apply stash@{1}’\u5c31\u53ef\u4ee5\u5c06\u4f60\u6307\u5b9a\u7248\u672c\u53f7\u4e3astash@{1}\u7684\u5de5\u4f5c\u53d6\u51fa\u6765\uff0c\u5f53\u4f60\u5c06\u6240\u6709\u7684\u6808\u90fd\u5e94\u7528\u56de\u6765\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u4f7f\u7528’git stash clear’\u6765\u5c06\u6808\u6e05\u7a7a\u3002<\/p>\n \u8bb0\u4f4f\u5982\u679c\u591a\u6b21”stash apply”\u67d0\u4e2a\u7248\u672c\u53f7\uff0c\u5219\u4f1a\u51fa\u73b0\u7248\u672c\u51b2\u7a81.<\/em><\/p>\n \u5728\u8fd9\u91cc\u987a\u4fbf\u63d0\u4e0bgit format-patch -n , n\u662f\u5177\u4f53\u67d0\u4e2a\u6570\u5b57\uff0c \u4f8b\u5982 ‘git format-patch -1’ \u8fd9\u65f6\u4fbf\u4f1a\u6839\u636elog\u751f\u6210\u4e00\u4e2a\u5bf9\u5e94\u7684\u8865\u4e01\uff0c\u5982\u679c ‘git format-patch -2’ \u90a3\u4e48\u4fbf\u4f1a\u751f\u62102\u4e2a\u8865\u4e01\uff0c\u5f53\u7136\u524d\u63d0\u662f\u4f60\u7684log\u4e0a\u6709\u81f3\u5c11\u6709\u4e24\u4e2a\u8bb0\u5f55\u3002<\/p>\n \u770b\u8fc7\u4e0a\u9762\u7684\u4fe1\u606f\uff0c\u5c31\u53ef\u4ee5\u77e5\u9053\u4f7f\u7528\u573a\u5408\u4e86\uff1a\u5f53\u524d\u5de5\u4f5c\u533a\u5185\u5bb9\u5df2\u88ab\u4fee\u6539\uff0c\u4f46\u662f\u5e76\u672a\u5b8c\u6210\u3002\u8fd9\u65f6Boss\u6765\u4e86\uff0c\u8bf4\u524d\u9762\u7684\u5206\u652f\u4e0a\u9762\u6709\u4e00\u4e2aBug\uff0c\u9700\u8981\u7acb\u5373\u4fee\u590d\u3002\u53ef\u662f\u6211\u53c8\u4e0d\u60f3\u63d0\u4ea4\u76ee\u524d\u7684\u4fee\u6539\uff0c\u56e0\u4e3a\u4fee\u6539\u6ca1\u6709\u5b8c\u6210\u3002\u4f46\u662f\uff0c\u4e0d\u63d0\u4ea4\u7684\u8bdd\uff0c\u53c8\u6ca1\u6709\u529e\u6cd5checkout\u5230\u524d\u9762\u7684\u5206\u652f\u3002\u6b64\u65f6\u7528Git Stash\u5c31\u76f8\u5f53\u4e8e\u5907\u4efd\u5de5\u4f5c\u533a\u4e86\u3002\u7136\u540e\u5728Checkout\u8fc7\u53bb\u4fee\u6539\uff0c\u5c31\u80fd\u591f\u8fbe\u5230\u4fdd\u5b58\u5f53\u524d\u5de5\u4f5c\u533a\uff0c\u5e76\u53ca\u65f6\u6062\u590d\u7684\u4f5c\u7528\u3002<\/p>\n \u53c2\u8003\u8d44\u6599\uff1a<\/strong><\/p>\n \u5f53\u4f60\u6b63\u5728\u505a\u4e00\u9879\u590d\u6742\u7684\u5de5\u4f5c\u65f6, \u53d1\u73b0\u4e86\u4e00\u4e2a\u548c\u5f53\u524d\u5de5\u4f5c\u4e0d\u76f8\u5173\u4f46\u662f\u53c8\u5f88\u8ba8\u538c\u7684bug. \u4f60\u8fd9\u65f6\u60f3\u5148\u4fee\u590dbug\u518d\u505a\u624b\u5934\u7684 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[63,64],"_links":{"self":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1478"}],"collection":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/comments?post=1478"}],"version-history":[{"count":4,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1478\/revisions"}],"predecessor-version":[{"id":1481,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1478\/revisions\/1481"}],"wp:attachment":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/media?parent=1478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/categories?post=1478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/tags?post=1478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\n
\n