{"id":709,"date":"2025-09-02T16:18:41","date_gmt":"2025-09-02T08:18:41","guid":{"rendered":"https:\/\/znl.pub\/?p=709"},"modified":"2026-02-03T12:10:11","modified_gmt":"2026-02-03T04:10:11","slug":"%e5%9c%a8-vs-code-%e4%b8%ad%e4%bd%bf%e7%94%a8-git-%e6%8f%90%e4%ba%a4%e9%83%a8%e5%88%86%e6%96%87%e4%bb%b6%e4%bf%ae%e6%94%b9","status":"publish","type":"post","link":"https:\/\/znl.pub\/?p=709","title":{"rendered":"\u5728 VS Code \u4e2d\u4f7f\u7528 Git \u63d0\u4ea4\u90e8\u5206\u6587\u4ef6\u4fee\u6539"},"content":{"rendered":"\n<p>\u8fd9\u91cc\u6709\u9700\u8981\u4e00\u4e2a\u6982\u5ff5\u53eb  <strong>\u6682\u5b58\u66f4\u6539(Stage Changes)<\/strong>\u3002\u8981\u533a\u522b\u4e8e <strong>\u6401\u7f6e\u66f4\u6539(Stash Changes)<\/strong>\u3002\u6682\u5b58\u66f4\u6539\u5e76\u4e0d\u662f\u8bf4\u6682\u65f6\u6401\u7f6e\u4e0d\u63d0\u4ea4\u7684\u90e8\u5206\uff0c\u76f8\u53cd\uff0c<strong>\u6682\u5b58\u66f4\u6539<\/strong>\u662f\u4f60\u60f3<strong>\u4e34\u65f6\u63d0\u4ea4\u7684<\/strong>\u5185\u5bb9\u3002<\/p>\n\n\n\n<p><strong>\u6682\u5b58\u66f4\u6539(Stage Changes)<\/strong>\uff1a \u5c06\u5de5\u4f5c\u76ee\u5f55\u4e2d\u7684<strong>\u7279\u5b9a\u4fee\u6539<\/strong>\u6807\u8bb0\u4e3a&#8221;\u51c6\u5907\u63d0\u4ea4&#8221;\u7684\u72b6\u6001\uff0c\u662f\u63d0\u4ea4\u524d\u7684\u51c6\u5907\u6b65\u9aa4\uff08git add \u7684\u64cd\u4f5c\uff09<\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u573a\u666f<\/strong>\uff1a\u9009\u62e9\u6027\u5730\u63d0\u4ea4<strong>\u90e8\u5206\u6587\u4ef6<\/strong>\u7684\u4fee\u6539\uff0c\u6216\u4e00\u4e2a\u6587\u4ef6\u4e2d\u7684<strong>\u90e8\u5206\u4ee3\u7801\u5757<\/strong>\uff08\u800c\u4e0d\u662f\u6574\u4e2a\u6587\u4ef6\uff09\u3002<\/p>\n\n\n\n<p><strong>VS Code\u64cd\u4f5c<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5728\u6e90\u4ee3\u7801\u7ba1\u7406\u89c6\u56fe\u4e2d<\/li>\n\n\n\n<li>\u70b9\u51fb\u6587\u4ef6\u65c1\u7684<code>+<\/code>\u53f7\u6682\u5b58\u6574\u4e2a\u6587\u4ef6<\/li>\n\n\n\n<li>\u6216\u70b9\u51fb<code>...<\/code>\u9009\u62e9&#8221;\u6682\u5b58\u6240\u9009\u8303\u56f4&#8221;\u6765\u6682\u5b58\u7279\u5b9a\u4ee3\u7801\u5757<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"473\" height=\"440\" src=\"https:\/\/znl.pub\/wp-content\/uploads\/2025\/09\/\u56fe\u7247-1.png\" alt=\"\" class=\"wp-image-765\" srcset=\"https:\/\/znl.pub\/wp-content\/uploads\/2025\/09\/\u56fe\u7247-1.png 473w, https:\/\/znl.pub\/wp-content\/uploads\/2025\/09\/\u56fe\u7247-1-300x279.png 300w\" sizes=\"auto, (max-width: 473px) 100vw, 473px\" \/><\/figure>\n\n\n\n<p><strong><strong>\u547d\u4ee4\u884c\u7b49\u6548<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> git add \u6587\u4ef6\u540d       # \u6682\u5b58\u6574\u4e2a\u6587\u4ef6\n git add -p \u6587\u4ef6\u540d    # \u4ea4\u4e92\u5f0f\u9009\u62e9\u4ee3\u7801\u5757\u6682\u5b58<\/code><\/pre>\n\n\n\n<p><strong>\u6401\u7f6e\u66f4\u6539(Stash Changes)<\/strong>\uff1a\u5c06\u5de5\u4f5c\u76ee\u5f55\u4e2d\u7684<strong>\u6240\u6709\u672a\u63d0\u4ea4\u4fee\u6539<\/strong>\u4e34\u65f6\u4fdd\u5b58\u5230\u6808\u4e2d\uff0c\u6e05\u7a7a\u5de5\u4f5c\u76ee\u5f55\uff0c\u672c\u8d28\u662f\u662f\u4e34\u65f6\u4fdd\u5b58\u5de5\u4f5c\u8fdb\u5ea6\u7684\u64cd\u4f5c\uff08<code>git stash<\/code> \u7684\u64cd\u4f5c\uff09<\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u573a\u666f<\/strong><\/p>\n\n\n\n<p>\u9700\u8981\u5207\u6362\u5206\u652f\u4f46\u4e0d\u60f3\u63d0\u4ea4\u5f53\u524d\u534a\u6210\u54c1\u5de5\u4f5c\u6216\u4e34\u65f6\u4fee\u590d\u7d27\u6025bug\u65f6\u9700\u8981\u5e72\u51c0\u7684\u5de5\u4f5c\u76ee\u5f55<\/p>\n\n\n\n<p><strong>VS Code\u64cd\u4f5c<\/strong>\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5728\u6e90\u4ee3\u7801\u7ba1\u7406\u89c6\u56fe\u4e2d<\/li>\n\n\n\n<li>\u70b9\u51fb<code>...<\/code>\u9009\u62e9&#8221;\u5b58\u50a8\u66f4\u6539&#8221;<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"540\" height=\"714\" src=\"https:\/\/znl.pub\/wp-content\/uploads\/2025\/09\/\u56fe\u7247.png\" alt=\"\" class=\"wp-image-711\" srcset=\"https:\/\/znl.pub\/wp-content\/uploads\/2025\/09\/\u56fe\u7247.png 540w, https:\/\/znl.pub\/wp-content\/uploads\/2025\/09\/\u56fe\u7247-227x300.png 227w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/figure>\n\n\n\n<p><strong>\u547d\u4ee4\u884c\u7b49\u6548<\/strong>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  git stash           # \u5b58\u50a8\u6240\u6709\u672a\u63d0\u4ea4\u66f4\u6539\n  git stash pop       # \u6062\u590d\u6700\u8fd1\u5b58\u50a8\u7684\u66f4\u6539<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><\/th><th>\u6682\u5b58\u66f4\u6539 (Stage)<\/th><th>\u6401\u7f6e\u66f4\u6539 (Stash)<\/th><\/tr><\/thead><tbody><tr><td><strong>\u76ee\u7684<\/strong><\/td><td>\u51c6\u5907\u8981\u63d0\u4ea4\u7684\u7279\u5b9a\u5185\u5bb9<\/td><td>\u4e34\u65f6\u4fdd\u5b58\u6240\u6709\u672a\u63d0\u4ea4\u7684\u5de5\u4f5c<\/td><\/tr><tr><td><strong>\u5f71\u54cd\u8303\u56f4<\/strong><\/td><td>\u53ef\u9009\u62e9\u90e8\u5206\u6587\u4ef6\/\u4ee3\u7801\u5757<\/td><td>\u603b\u662f\u5f71\u54cd\u6240\u6709\u672a\u63d0\u4ea4\u4fee\u6539<\/td><\/tr><tr><td><strong>Git\u547d\u4ee4<\/strong><\/td><td><code>git add<\/code><\/td><td><code>git stash<\/code><\/td><\/tr><tr><td><strong>\u540e\u7eed\u64cd\u4f5c<\/strong><\/td><td>\u9700\u8981\u6267\u884c<code>git commit<\/code><\/td><td>\u9700\u8981\u6267\u884c<code>git stash pop<\/code><\/td><\/tr><tr><td><strong>\u662f\u5426\u6e05\u7a7a\u5de5\u4f5c\u533a<\/strong><\/td><td>\u5426<\/td><td>\u662f<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>\u6401\u7f6e\u5de5\u4f5c\u6d41<\/strong>\uff08\u4e34\u65f6\u4fdd\u5b58\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   git stash               # \u4fdd\u5b58\u6240\u6709\u4fee\u6539\n   git checkout hotfix     # \u5207\u6362\u5230\u5176\u4ed6\u5206\u652f\n   # \u5904\u7406\u7d27\u6025\u4efb\u52a1...\n   git checkout main       # \u5207\u56de\u539f\u5206\u652f\n   git stash pop           # \u6062\u590d\u4e4b\u524d\u7684\u5de5\u4f5c<\/code><\/pre>\n\n\n\n<p>\u8fd8\u8981\u6ce8\u610f\u7684\u662f\uff0cgit stash \u53ea\u4fdd\u5b58\u8ddf\u8e2a\u7684\u6587\u4ef6\uff0c\u5bf9\u4e8e\u65b0\u5efa\u7684\u4f46\u662f\u6ca1\u6709commit\u7684\u4ed6\u662f\u4e0d\u4f1a\u4e34\u65f6\u4fdd\u5b58\u7684\u3002\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u91cc\u6709\u9700\u8981\u4e00\u4e2a\u6982\u5ff5\u53eb \u6682\u5b58\u66f4\u6539(Stage Changes)\u3002\u8981\u533a\u522b\u4e8e \u6401\u7f6e\u66f4\u6539(Stash Changes)&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-709","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/posts\/709","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/znl.pub\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=709"}],"version-history":[{"count":3,"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/posts\/709\/revisions"}],"predecessor-version":[{"id":766,"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/posts\/709\/revisions\/766"}],"wp:attachment":[{"href":"https:\/\/znl.pub\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/znl.pub\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/znl.pub\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}