{"id":21518,"date":"2024-11-19T16:56:02","date_gmt":"2024-11-19T08:56:02","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21518\/"},"modified":"2024-11-19T16:56:02","modified_gmt":"2024-11-19T08:56:02","slug":"git%e6%80%8e%e4%b9%88%e4%b8%8a%e4%bc%a0%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21518\/","title":{"rendered":"git\u600e\u4e48\u4e0a\u4f20\u6587\u4ef6"},"content":{"rendered":"<blockquote><p>\n  \u8981\u5c06\u6587\u4ef6\u4e0a\u4f20\u5230 git \u4ed3\u5e93\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a1. \u4f7f\u7528\u201cgit add\u201d\u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\uff1b2. \u4f7f\u7528\u201cgit commit\u201d\u63d0\u4ea4\u66f4\u6539\uff0c\u5e76\u63d0\u4f9b\u63d0\u4ea4\u6d88\u606f\uff1b3. \u4f7f\u7528\u201cgit push\u201d\u5c06\u63d0\u4ea4\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/30\/2024053023032021644.jpg\" class=\"aligncenter\" title=\"git\u600e\u4e48\u4e0a\u4f20\u6587\u4ef6\u63d2\u56fe\" alt=\"git\u600e\u4e48\u4e0a\u4f20\u6587\u4ef6\u63d2\u56fe\" \/><\/p>\n<h2>\u5982\u4f55\u5c06\u6587\u4ef6\u4e0a\u4f20\u5230 Git \u4ed3\u5e93<\/h2>\n<p>Git \u662f\u4e00\u79cd\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u5b83\u5141\u8bb8\u56e2\u961f\u6210\u5458\u534f\u4f5c\u5f00\u53d1\u9879\u76ee\u5e76\u8ddf\u8e2a\u4ee3\u7801\u66f4\u6539\u3002\u8981\u5c06\u6587\u4ef6\u4e0a\u4f20\u5230 Git \u4ed3\u5e93\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<h3>\u6b65\u9aa4 1\uff1a\u6dfb\u52a0\u8981\u4e0a\u4f20\u7684\u6587\u4ef6<\/h3>\n<p> add \u547d\u4ee4\u7528\u4e8e\u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\uff0c\u8fd9\u662f\u60a8\u8981\u63d0\u4ea4\u66f4\u6539\u4e4b\u524d\u6240\u51c6\u5907\u7684\u6587\u4ef6\u7684\u96c6\u5408\u3002<\/p>\n<p>\u8bed\u6cd5\uff1agit add <\/p>\n<p>\u4f8b\u5982\uff1agit add my_file.txt<\/p>\n<h3>\u6b65\u9aa4 2\uff1a\u63d0\u4ea4\u66f4\u6539<\/h3>\n<p>git commit \u547d\u4ee4\u5c06\u5bf9\u6682\u5b58\u533a\u4e2d\u7684\u6587\u4ef6\u8fdb\u884c\u5feb\u7167\u5e76\u521b\u5efa\u63d0\u4ea4\uff0c\u8fd9\u662f\u5b58\u50a8\u4ee3\u7801\u66f4\u6539\u7684\u5386\u53f2\u8bb0\u5f55\u3002<\/p>\n<p>\u8bed\u6cd5\uff1agit commit -m &#8220;&#8221;<\/p>\n<p>\u4f8b\u5982\uff1agit commit -m &#8220;\u4fee\u590d\u4e86 my_file.txt \u4e2d\u7684\u9519\u8bef&#8221;<\/p>\n<h3>\u6b65\u9aa4 3\uff1a\u63a8\u9001\u63d0\u4ea4<\/h3>\n<p>git push \u547d\u4ee4\u5c06\u60a8\u7684\u672c\u5730\u63d0\u4ea4\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u4ee5\u4fbf\u5176\u4ed6\u56e2\u961f\u6210\u5458\u53ef\u4ee5\u8bbf\u95ee\u5b83\u4eec\u3002<\/p>\n<p>\u8bed\u6cd5\uff1agit push <\/p>\n<p>\u4f8b\u5982\uff1agit push origin master<\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u8fdc\u7a0b\u540d\u79f0\u662f\u60a8\u5728\u514b\u9686\u4ed3\u5e93\u65f6\u6307\u5b9a\u7684\u540d\u79f0\u3002<\/li>\n<li>\u5206\u652f\u540d\u79f0\u901a\u5e38\u662f\u60a8\u6b63\u5728\u5f00\u53d1\u7684\u5206\u652f\uff0c\u4f8b\u5982 master \u6216 feature\/new-feature\u3002<\/li>\n<\/ul>\n<h3>\u8be6\u7ec6\u8bf4\u660e<\/h3>\n<p><strong>\u6dfb\u52a0\u6587\u4ef6\u5230\u6682\u5b58\u533a\uff1a<\/strong><\/p>\n<p>git add \u547d\u4ee4\u63a5\u53d7\u5355\u4e2a\u6587\u4ef6\u6216\u4e00\u7ec4\u6587\u4ef6\u7684\u8def\u5f84\u4f5c\u4e3a\u53c2\u6570\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u901a\u914d\u7b26\uff08\u4f8b\u5982 *\uff09\u6765\u5339\u914d\u591a\u4e2a\u6587\u4ef6\u3002<\/p>\n<p><strong>\u63d0\u4ea4\u66f4\u6539\uff1a<\/strong><\/p>\n<p>git commit \u547d\u4ee4\u63a5\u53d7\u4e00\u4e2a\u5fc5\u9700\u7684\u53c2\u6570\uff1a\u63d0\u4ea4\u6d88\u606f\u3002\u63d0\u4ea4\u6d88\u606f\u662f\u5bf9\u6240\u505a\u66f4\u6539\u7684\u7b80\u8981\u8bf4\u660e\u3002<\/p>\n<p><strong>\u63a8\u9001\u63d0\u4ea4\uff1a<\/strong><\/p>\n<p>git push \u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u6307\u5b9a\u4e86\u8fdc\u7a0b\u4ed3\u5e93\u7684\u540d\u79f0\u3002\u7b2c\u4e8c\u4e2a\u53c2\u6570\u6307\u5b9a\u4e86\u60a8\u8981\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5206\u652f\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u4ee5\u4e0b\u547d\u4ee4\u5c06 my_file.txt \u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\uff0c\u63d0\u4ea4\u66f4\u6539\u5e76\u5c06\u5176\u63a8\u9001\u5230\u540d\u4e3a origin \u7684\u8fdc\u7a0b\u4ed3\u5e93\u7684 master \u5206\u652f\uff1a<\/p>\n<pre>git add my_file.txt\ngit commit -m \"\u4fee\u590d\u4e86 my_file.txt \u4e2d\u7684\u9519\u8bef\"\ngit push origin master<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u4e0a\u4f20\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>\u8981\u5c06\u6587\u4ef6\u4e0a\u4f20\u5230 git \u4ed3\u5e93\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a1. \u4f7f\u7528\u201cgit add\u201d\u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\uff1b2. \u4f7f\u7528\u201cgit commit\u201d\u63d0\u4ea4\u66f4\u6539\uff0c\u5e76\u63d0\u4f9b\u63d0\u4ea4\u6d88\u606f\uff1b3. \u4f7f\u7528\u201cgit push\u201d\u5c06\u63d0\u4ea4\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u3002 \u5982\u4f55\u5c06\u6587\u4ef6\u4e0a\u4f20\u5230 Git \u4ed3\u5e93 Git \u662f\u4e00\u79cd\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u5b83\u5141\u8bb8\u56e2\u961f\u6210\u5458\u534f\u4f5c\u5f00\u53d1\u9879\u76ee\u5e76\u8ddf\u8e2a\u4ee3\u7801\u66f4\u6539\u3002\u8981\u5c06\u6587\u4ef6\u4e0a\u4f20\u5230 Git \u4ed3\u5e93\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a \u6b65\u9aa4 1\uff1a\u6dfb\u52a0\u8981\u4e0a\u4f20\u7684\u6587\u4ef6 add \u547d\u4ee4\u7528\u4e8e\u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\uff0c\u8fd9\u662f\u60a8\u8981\u63d0\u4ea4\u66f4\u6539\u4e4b\u524d\u6240\u51c6\u5907\u7684\u6587\u4ef6\u7684\u96c6\u5408\u3002 \u8bed\u6cd5\uff1agit add \u4f8b\u5982\uff1agit add my_file.txt \u6b65\u9aa4 2\uff1a\u63d0\u4ea4\u66f4\u6539 git commit \u547d\u4ee4\u5c06\u5bf9\u6682\u5b58\u533a\u4e2d\u7684\u6587\u4ef6\u8fdb\u884c\u5feb\u7167\u5e76\u521b\u5efa\u63d0\u4ea4\uff0c\u8fd9\u662f\u5b58\u50a8\u4ee3\u7801\u66f4\u6539\u7684\u5386\u53f2\u8bb0\u5f55\u3002 \u8bed\u6cd5\uff1agit commit -m &#8220;&#8221; \u4f8b\u5982\uff1agit commit -m &#8220;\u4fee\u590d\u4e86 my_file.txt \u4e2d\u7684\u9519\u8bef&#8221; \u6b65\u9aa4 3\uff1a\u63a8\u9001\u63d0\u4ea4 git push \u547d\u4ee4\u5c06\u60a8\u7684\u672c\u5730\u63d0\u4ea4\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u4ee5\u4fbf\u5176\u4ed6\u56e2\u961f\u6210\u5458\u53ef\u4ee5\u8bbf\u95ee\u5b83\u4eec\u3002 \u8bed\u6cd5\uff1agit push \u4f8b\u5982\uff1agit push origin master \u6ce8\u610f\uff1a \u8fdc\u7a0b\u540d\u79f0\u662f\u60a8\u5728\u514b\u9686\u4ed3\u5e93\u65f6\u6307\u5b9a\u7684\u540d\u79f0\u3002 \u5206\u652f\u540d\u79f0\u901a\u5e38\u662f\u60a8\u6b63\u5728\u5f00\u53d1\u7684\u5206\u652f\uff0c\u4f8b\u5982 master [&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-21518","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21518","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=21518"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21518\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}