{"id":21224,"date":"2024-11-19T13:12:30","date_gmt":"2024-11-19T05:12:30","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21224\/"},"modified":"2024-11-19T13:12:30","modified_gmt":"2024-11-19T05:12:30","slug":"git%e5%a6%82%e4%bd%95%e6%8f%90%e4%ba%a4%e5%88%a0%e9%99%a4%e7%9a%84%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21224\/","title":{"rendered":"git\u5982\u4f55\u63d0\u4ea4\u5220\u9664\u7684\u6587\u4ef6"},"content":{"rendered":"<blockquote><p>\n  \u4f7f\u7528 git \u63d0\u4ea4\u5220\u9664\u7684\u6587\u4ef6\uff1a\u4f7f\u7528 git rm \u547d\u4ee4\u4ece\u6682\u5b58\u533a\u57df\u79fb\u9664\u6587\u4ef6\u3002\u4f7f\u7528 git add \u547d\u4ee4\u5bf9\u79fb\u9664\u66f4\u6539\u8fdb\u884c\u5206\u9636\u6bb5\u3002\u4f7f\u7528 git commit \u547d\u4ee4\u63d0\u4ea4\u5220\u9664\u6587\u4ef6\uff0c\u5305\u62ec\u63d0\u4ea4\u6d88\u606f\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/09\/2024040913061948035.jpg\" class=\"aligncenter\" title=\"git\u5982\u4f55\u63d0\u4ea4\u5220\u9664\u7684\u6587\u4ef6\u63d2\u56fe\" alt=\"git\u5982\u4f55\u63d0\u4ea4\u5220\u9664\u7684\u6587\u4ef6\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4f7f\u7528 Git \u63d0\u4ea4\u5220\u9664\u7684\u6587\u4ef6<\/strong><\/p>\n<p><strong>\u7b2c\u4e00\u6b65\uff1a\u4f7f\u7528  rm \u547d\u4ee4<\/strong><\/p>\n<p>\u5220\u9664\u6587\u4ef6\u7684\u7b2c\u4e00\u6b65\u662f\u4f7f\u7528 git rm \u547d\u4ee4\u3002\u6b64\u547d\u4ee4\u7528\u4e8e\u4ece Git \u8ddf\u8e2a\u4e2d\u5220\u9664\u6587\u4ef6\uff0c\u4f7f\u5176\u4ece\u6682\u5b58\u533a\u57df\u4e2d\u79fb\u9664\u3002<\/p>\n<p>\u8bed\u6cd5\uff1a<\/p>\n<pre>git rm &lt;\u6587\u4ef6\u8def\u5f84&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u4ece\u6682\u5b58\u533a\u57df\u5220\u9664\u540d\u4e3a myfile.txt \u7684\u6587\u4ef6\uff0c\u53ef\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git rm myfile.txt<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u7b2c\u4e8c\u6b65\uff1a\u5206\u9636\u6bb5\u66f4\u6539<\/strong><\/p>\n<p>\u5220\u9664\u6587\u4ef6\u540e\uff0c\u9700\u8981\u5bf9\u66f4\u6539\u8fdb\u884c\u5206\u9636\u6bb5\u3002\u8fd9\u4f1a\u5c06\u66f4\u6539\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u57df\uff0c\u4ee5\u4fbf\u5728\u63d0\u4ea4\u65f6\u5305\u542b\u5728\u5185\u3002<\/p>\n<p>\u4f7f\u7528 git add \u547d\u4ee4\u5bf9\u66f4\u6539\u8fdb\u884c\u5206\u9636\u6bb5\uff1a<\/p>\n<pre>git add &lt;\u6587\u4ef6\u8def\u5f84&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u65e0\u9700\u6307\u5b9a\u6587\u4ef6\u8def\u5f84\uff0c\u56e0\u4e3a git rm \u547d\u4ee4\u5df2\u5c06\u66f4\u6539\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u57df\u3002<\/p>\n<p><strong>\u7b2c\u4e09\u6b65\uff1a\u63d0\u4ea4\u66f4\u6539<\/strong><\/p>\n<p>\u6700\u540e\uff0c\u4f7f\u7528 git commit \u547d\u4ee4\u63d0\u4ea4\u66f4\u6539\uff0c\u5305\u62ec\u5220\u9664\u7684\u6587\u4ef6\u3002<\/p>\n<p>\u8bed\u6cd5\uff1a<\/p>\n<pre>git commit -m \"&lt;\u63d0\u4ea4\u6d88\u606f&gt;\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u63d0\u4ea4\u5220\u9664\u6587\u4ef6\u7684\u66f4\u6539\uff0c\u53ef\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git commit -m \"Deleted myfile.txt\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6b64\u547d\u4ee4\u4f1a\u5c06\u5220\u9664\u6587\u4ef6 myfile.txt \u7684\u66f4\u6539\u63d0\u4ea4\u5230 Git \u4ed3\u5e93\u4e2d\u3002<\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u5728\u5220\u9664\u6587\u4ef6\u4e4b\u524d\uff0c\u786e\u4fdd\u5df2\u6682\u5b58\u4efb\u4f55\u672a\u63d0\u4ea4\u7684\u66f4\u6539\u3002<\/li>\n<li>Git \u65e0\u6cd5\u6062\u590d\u5df2\u5220\u9664\u7684\u6587\u4ef6\uff0c\u9664\u975e\u4f7f\u7528\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u5916\u7684\u7b2c\u4e09\u65b9\u5de5\u5177\u3002<\/li>\n<li>\u5220\u9664\u6587\u4ef6\u540e\uff0c\u5b83\u5c06\u4ece Git \u5386\u53f2\u8bb0\u5f55\u4e2d\u6c38\u4e45\u5220\u9664\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u63d0\u4ea4\u5220\u9664\u7684\u6587\u4ef6\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 git \u63d0\u4ea4\u5220\u9664\u7684\u6587\u4ef6\uff1a\u4f7f\u7528 git rm \u547d\u4ee4\u4ece\u6682\u5b58\u533a\u57df\u79fb\u9664\u6587\u4ef6\u3002\u4f7f\u7528 git add \u547d\u4ee4\u5bf9\u79fb\u9664\u66f4\u6539\u8fdb\u884c\u5206\u9636\u6bb5\u3002\u4f7f\u7528 git commit \u547d\u4ee4\u63d0\u4ea4\u5220\u9664\u6587\u4ef6\uff0c\u5305\u62ec\u63d0\u4ea4\u6d88\u606f\u3002 \u5982\u4f55\u4f7f\u7528 Git \u63d0\u4ea4\u5220\u9664\u7684\u6587\u4ef6 \u7b2c\u4e00\u6b65\uff1a\u4f7f\u7528 rm \u547d\u4ee4 \u5220\u9664\u6587\u4ef6\u7684\u7b2c\u4e00\u6b65\u662f\u4f7f\u7528 git rm \u547d\u4ee4\u3002\u6b64\u547d\u4ee4\u7528\u4e8e\u4ece Git \u8ddf\u8e2a\u4e2d\u5220\u9664\u6587\u4ef6\uff0c\u4f7f\u5176\u4ece\u6682\u5b58\u533a\u57df\u4e2d\u79fb\u9664\u3002 \u8bed\u6cd5\uff1a git rm &lt;\u6587\u4ef6\u8def\u5f84&gt; \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff0c\u8981\u4ece\u6682\u5b58\u533a\u57df\u5220\u9664\u540d\u4e3a myfile.txt \u7684\u6587\u4ef6\uff0c\u53ef\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a git rm myfile.txt \u767b\u5f55\u540e\u590d\u5236 \u7b2c\u4e8c\u6b65\uff1a\u5206\u9636\u6bb5\u66f4\u6539 \u5220\u9664\u6587\u4ef6\u540e\uff0c\u9700\u8981\u5bf9\u66f4\u6539\u8fdb\u884c\u5206\u9636\u6bb5\u3002\u8fd9\u4f1a\u5c06\u66f4\u6539\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u57df\uff0c\u4ee5\u4fbf\u5728\u63d0\u4ea4\u65f6\u5305\u542b\u5728\u5185\u3002 \u4f7f\u7528 git add \u547d\u4ee4\u5bf9\u66f4\u6539\u8fdb\u884c\u5206\u9636\u6bb5\uff1a git add &lt;\u6587\u4ef6\u8def\u5f84&gt; \u767b\u5f55\u540e\u590d\u5236 \u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u65e0\u9700\u6307\u5b9a\u6587\u4ef6\u8def\u5f84\uff0c\u56e0\u4e3a git rm \u547d\u4ee4\u5df2\u5c06\u66f4\u6539\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u57df\u3002 \u7b2c\u4e09\u6b65\uff1a\u63d0\u4ea4\u66f4\u6539 \u6700\u540e\uff0c\u4f7f\u7528 git commit \u547d\u4ee4\u63d0\u4ea4\u66f4\u6539\uff0c\u5305\u62ec\u5220\u9664\u7684\u6587\u4ef6\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-21224","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=21224"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21224\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}