{"id":21547,"date":"2024-11-19T10:08:39","date_gmt":"2024-11-19T02:08:39","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21547\/"},"modified":"2024-11-19T10:08:39","modified_gmt":"2024-11-19T02:08:39","slug":"git%e4%b8%8a%e4%bc%a0%e6%96%87%e4%bb%b6%e6%80%8e%e4%b9%88%e4%bc%a0","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21547\/","title":{"rendered":"git\u4e0a\u4f20\u6587\u4ef6\u600e\u4e48\u4f20"},"content":{"rendered":"<blockquote><p>\n  git \u6587\u4ef6\u4e0a\u4f20\u6b65\u9aa4\u5982\u4e0b\uff1a\u4f7f\u7528 git add \u6682\u5b58\u66f4\u6539\u3002\u4f7f\u7528 git commit \u63d0\u4ea4\u66f4\u6539\u3002\u4f7f\u7528 git push \u63a8\u9001\u66f4\u6539\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/30\/2024053023425938793.jpg\" class=\"aligncenter\" title=\"git\u4e0a\u4f20\u6587\u4ef6\u600e\u4e48\u4f20\u63d2\u56fe\" alt=\"git\u4e0a\u4f20\u6587\u4ef6\u600e\u4e48\u4f20\u63d2\u56fe\" \/><\/p>\n<p><strong>Git \u4e0a\u4f20\u6587\u4ef6<\/strong><\/p>\n<p>\u5728 Git \u4e2d\u4e0a\u4f20\u6587\u4ef6\uff08\u4ee3\u7801\uff09\u662f\u4e00\u4e2a\u5206\u6b65\u7684\u8fc7\u7a0b\uff0c\u6d89\u53ca\u6682\u5b58\u3001\u63d0\u4ea4\u548c\u63a8\u9001\u3002<\/p>\n<p><strong>1. \u6682\u5b58\u66f4\u6539<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528  add \u547d\u4ee4\u5c06\u66f4\u6539\u7684\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u3002<\/li>\n<li>\u6682\u5b58\u533a\u662f Git \u7528\u4e8e\u8ddf\u8e2a\u54ea\u4e9b\u6587\u4ef6\u5df2\u51c6\u5907\u63d0\u4ea4\u7684\u533a\u57df\u3002<\/li>\n<\/ul>\n<pre>git add my-file.txt<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u63d0\u4ea4\u66f4\u6539<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528 git commit \u547d\u4ee4\u5c06\u6682\u5b58\u533a\u4e2d\u7684\u66f4\u6539\u63d0\u4ea4\u5230\u3002<\/li>\n<li>\u63d0\u4ea4\u6d88\u606f\u5c06\u63cf\u8ff0\u66f4\u6539\u7684\u5185\u5bb9\u3002<\/li>\n<\/ul>\n<pre>git commit -m \"Added new feature\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u63a8\u9001\u66f4\u6539<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528 git push \u547d\u4ee4\u5c06\u672c\u5730\u4ed3\u5e93\u4e2d\u7684\u63d0\u4ea4\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff08\u4f8b\u5982 GitHub \u6216 GitLab\uff09\u3002<\/li>\n<li>\u6307\u5b9a\u8fdc\u7a0b\u4ed3\u5e93\u7684\u540d\u79f0\u548c\u8981\u63a8\u9001\u7684\u5206\u652f\u3002<\/li>\n<\/ul>\n<pre>git push origin main<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u8be6\u7ec6\u6b65\u9aa4<\/strong><\/p>\n<ol>\n<li> <strong>\u5b89\u88c5 Git\uff1a<\/strong>\u5728\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5 Git\u3002<\/li>\n<li> <strong>\u521d\u59cb\u5316 Git \u4ed3\u5e93\uff1a<\/strong>\u4f7f\u7528 git init \u547d\u4ee4\u5728\u9879\u76ee\u76ee\u5f55\u4e2d\u521d\u59cb\u5316 Git \u4ed3\u5e93\u3002<\/li>\n<li> <strong>\u521b\u5efa\u548c\u7f16\u8f91\u6587\u4ef6\uff1a<\/strong>\u521b\u5efa\u6216\u4fee\u6539\u8981\u4e0a\u4f20\u7684\u6587\u4ef6\u3002<\/li>\n<li> <strong>\u6682\u5b58\u66f4\u6539\uff1a<\/strong>\u4f7f\u7528 git add \u547d\u4ee4\u5c06\u66f4\u6539\u7684\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u3002<\/li>\n<li> <strong>\u63d0\u4ea4\u66f4\u6539\uff1a<\/strong>\u4f7f\u7528 git commit \u547d\u4ee4\u5c06\u6682\u5b58\u533a\u4e2d\u7684\u66f4\u6539\u63d0\u4ea4\u5230\u672c\u5730\u4ed3\u5e93\u3002<\/li>\n<li> <strong>\u914d\u7f6e\u8fdc\u7a0b\u4ed3\u5e93\uff1a<\/strong>\u5c06\u8fdc\u7a0b\u4ed3\u5e93\u7684 URL \u6dfb\u52a0\u5230\u672c\u5730\u4ed3\u5e93\u3002<\/li>\n<li> <strong>\u63a8\u9001\u66f4\u6539\uff1a<\/strong>\u4f7f\u7528 git push \u547d\u4ee4\u5c06\u672c\u5730\u4ed3\u5e93\u4e2d\u7684\u63d0\u4ea4\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u3002<\/li>\n<li> <strong>\u9a8c\u8bc1\u4e0a\u4f20\uff1a<\/strong>\u5728\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u68c0\u67e5\u6587\u4ef6\u662f\u5426\u5df2\u6210\u529f\u4e0a\u4f20\u3002<\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e0a\u4f20\u6587\u4ef6\u600e\u4e48\u4f20\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>git \u6587\u4ef6\u4e0a\u4f20\u6b65\u9aa4\u5982\u4e0b\uff1a\u4f7f\u7528 git add \u6682\u5b58\u66f4\u6539\u3002\u4f7f\u7528 git commit \u63d0\u4ea4\u66f4\u6539\u3002\u4f7f\u7528 git push \u63a8\u9001\u66f4\u6539\u3002 Git \u4e0a\u4f20\u6587\u4ef6 \u5728 Git \u4e2d\u4e0a\u4f20\u6587\u4ef6\uff08\u4ee3\u7801\uff09\u662f\u4e00\u4e2a\u5206\u6b65\u7684\u8fc7\u7a0b\uff0c\u6d89\u53ca\u6682\u5b58\u3001\u63d0\u4ea4\u548c\u63a8\u9001\u3002 1. \u6682\u5b58\u66f4\u6539 \u4f7f\u7528 add \u547d\u4ee4\u5c06\u66f4\u6539\u7684\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u3002 \u6682\u5b58\u533a\u662f Git \u7528\u4e8e\u8ddf\u8e2a\u54ea\u4e9b\u6587\u4ef6\u5df2\u51c6\u5907\u63d0\u4ea4\u7684\u533a\u57df\u3002 git add my-file.txt \u767b\u5f55\u540e\u590d\u5236 2. \u63d0\u4ea4\u66f4\u6539 \u4f7f\u7528 git commit \u547d\u4ee4\u5c06\u6682\u5b58\u533a\u4e2d\u7684\u66f4\u6539\u63d0\u4ea4\u5230\u3002 \u63d0\u4ea4\u6d88\u606f\u5c06\u63cf\u8ff0\u66f4\u6539\u7684\u5185\u5bb9\u3002 git commit -m &#8220;Added new feature&#8221; \u767b\u5f55\u540e\u590d\u5236 3. \u63a8\u9001\u66f4\u6539 \u4f7f\u7528 git push \u547d\u4ee4\u5c06\u672c\u5730\u4ed3\u5e93\u4e2d\u7684\u63d0\u4ea4\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff08\u4f8b\u5982 GitHub \u6216 GitLab\uff09\u3002 \u6307\u5b9a\u8fdc\u7a0b\u4ed3\u5e93\u7684\u540d\u79f0\u548c\u8981\u63a8\u9001\u7684\u5206\u652f\u3002 git push origin [&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-21547","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21547","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=21547"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21547\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}