{"id":21521,"date":"2024-11-19T10:06:44","date_gmt":"2024-11-19T02:06:44","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21521\/"},"modified":"2024-11-19T10:06:44","modified_gmt":"2024-11-19T02:06:44","slug":"git%e4%bb%93%e5%ba%93%e6%80%8e%e4%b9%88%e7%94%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21521\/","title":{"rendered":"git\u4ed3\u5e93\u600e\u4e48\u7528"},"content":{"rendered":"<blockquote><p>\n  git \u4ed3\u5e93\u662f\u4ee3\u7801\u548c\u6587\u4ef6\u7248\u672c\u5386\u53f2\u7684\u5b58\u50a8\u4f4d\u7f6e\uff0c\u7528\u4e8e\u8ddf\u8e2a\u66f4\u6539\u3001\u534f\u4f5c\u548c\u7ba1\u7406\u9879\u76ee\u7248\u672c\u3002\u8981\u4f7f\u7528 git \u4ed3\u5e93\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u521b\u5efa\u4ed3\u5e93\uff1a\u8fd0\u884c git init\u3002\u6dfb\u52a0\u6587\u4ef6\uff1a\u4f7f\u7528 git add \u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u3002\u63d0\u4ea4\u66f4\u6539\uff1a\u4f7f\u7528 git commit \u5c06\u6682\u5b58\u533a\u66f4\u6539\u5b58\u50a8\u5728\u4ed3\u5e93\u4e2d\u3002\u63a8\u9001\u66f4\u6539\uff1a\u4f7f\u7528 git push \u5c06\u66f4\u6539\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u3002\u62c9\u53d6\u66f4\u6539\uff1a\u4f7f\u7528 git pull \u4ece\u8fdc\u7a0b\u4ed3\u5e93\u83b7\u53d6\u66f4\u6539\u3002\u5206\u652f\uff1a\u4f7f\u7528 git branch \u521b\u5efa\u5206\u652f\u3002\u5408\u5e76\uff1a\u4f7f\u7528 git merge \u5c06\u4e0d\u540c\u5206\u652f\u7684\u66f4\u6539\u5408\u5e76\u3002\u6807\u8bb0\uff1a\u4f7f\u7528 git tag\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/30\/2024053023070110905.jpg\" class=\"aligncenter\" title=\"git\u4ed3\u5e93\u600e\u4e48\u7528\u63d2\u56fe\" alt=\"git\u4ed3\u5e93\u600e\u4e48\u7528\u63d2\u56fe\" \/><\/p>\n<p><strong>Git \u4ed3\u5e93\u8be6\u89e3<\/strong><\/p>\n<p>Git \u4ed3\u5e93\u662f\u4e00\u4e2a\u5b58\u50a8\u4ee3\u7801\u548c\u6587\u4ef6\u7248\u672c\u5386\u53f2\u7684\u4e2d\u592e\u4f4d\u7f6e\u3002\u5b83\u5141\u8bb8\u5f00\u53d1\u4eba\u5458\u8ddf\u8e2a\u4ee3\u7801\u7684\u66f4\u6539\u3001\u534f\u4f5c\u5de5\u4f5c\u5e76\u7ba1\u7406\u4e0d\u540c\u7248\u672c\u7684\u9879\u76ee\u3002<\/p>\n<p><strong>\u5982\u4f55\u4f7f\u7528 Git \u4ed3\u5e93\uff1a<\/strong><\/p>\n<p><strong>\u521b\u5efa\u4ed3\u5e93<\/strong><\/p>\n<ul>\n<li>\u5728\u60a8\u8981\u5b58\u50a8\u9879\u76ee\u7684\u76ee\u5f55\u4e2d\uff0c\u8fd0\u884c  init \u547d\u4ee4\u3002<\/li>\n<li>\u8fd9\u5c06\u5728\u8be5\u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2a .git \u6587\u4ef6\u5939\uff0c\u5176\u4e2d\u5305\u542b\u4ed3\u5e93\u7684\u5143\u6570\u636e\u3002<\/li>\n<\/ul>\n<p><strong>\u6dfb\u52a0\u6587\u4ef6<\/strong><\/p>\n<ul>\n<li>\u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u4ed3\u5e93\uff0c\u4f7f\u7528 git add \u547d\u4ee4\uff0c\u5982 git add README.md\u3002<\/li>\n<li>\u8fd9\u5c06\u628a\u6587\u4ef6\u6dfb\u52a0\u5230\u201c\u6682\u5b58\u533a\u201d\uff0c\u51c6\u5907\u63d0\u4ea4\u3002<\/li>\n<\/ul>\n<p><strong>\u63d0\u4ea4\u66f4\u6539<\/strong><\/p>\n<ul>\n<li>\u8981\u5c06\u66f4\u6539\u6c38\u4e45\u5b58\u50a8\u5728\u4ed3\u5e93\u4e2d\uff0c\u8bf7\u4f7f\u7528 git commit \u547d\u4ee4\uff0c\u5982 git commit -m &#8220;\u4fee\u590d\u4e86\u9519\u8bef&#8221;\u3002<\/li>\n<li>\u8fd9\u4f1a\u521b\u5efa\u4e00\u4e2a\u63d0\u4ea4\uff0c\u5c06\u6682\u5b58\u533a\u7684\u66f4\u6539\u79fb\u52a8\u5230\u4ed3\u5e93\u5386\u53f2\u8bb0\u5f55\u4e2d\u3002<\/li>\n<\/ul>\n<p><strong>\u63a8\u9001\u66f4\u6539<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u60f3\u4e0e\u4ed6\u4eba\u5171\u4eab\u66f4\u6539\uff0c\u8bf7\u5c06\u5b83\u4eec\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u5982 git push origin master\u3002<\/li>\n<li>\u8fdc\u7a0b\u4ed3\u5e93\u901a\u5e38\u6258\u7ba1\u5728 GitHub \u6216 GitLab \u7b49\u5e73\u53f0\u4e0a\u3002<\/li>\n<\/ul>\n<p><strong>\u62c9\u53d6\u66f4\u6539<\/strong><\/p>\n<ul>\n<li>\u82e5\u8981\u4ece\u8fdc\u7a0b\u4ed3\u5e93\u83b7\u53d6\u66f4\u6539\uff0c\u8bf7\u4f7f\u7528 git pull \u547d\u4ee4\uff0c\u5982 git pull origin master\u3002<\/li>\n<li>\u8fd9\u4f1a\u5c06\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u7684\u6700\u65b0\u66f4\u6539\u5408\u5e76\u5230\u4e2d\u3002<\/li>\n<\/ul>\n<p><strong>\u5206\u652f<\/strong><\/p>\n<ul>\n<li>\u5206\u652f\u53ef\u8ba9\u60a8\u521b\u5efa\u9879\u76ee\u4e0d\u540c\u7248\u672c\u7684\u526f\u672c\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u4e3b\u5206\u652f\u3002<\/li>\n<li>\u8981\u521b\u5efa\u5206\u652f\uff0c\u8bf7\u4f7f\u7528 git branch \u547d\u4ee4\uff0c\u5982 git branch new-branch\u3002<\/li>\n<li>\u8981\u5207\u6362\u5230\u5206\u652f\uff0c\u8bf7\u4f7f\u7528 git checkout \u547d\u4ee4\uff0c\u5982 git checkout new-branch\u3002<\/li>\n<\/ul>\n<p><strong>\u5408\u5e76<\/strong><\/p>\n<ul>\n<li>\u5408\u5e76\u5c06\u4e0d\u540c\u5206\u652f\u4e0a\u7684\u66f4\u6539\u5408\u5e76\u5728\u4e00\u8d77\u3002<\/li>\n<li>\u8981\u5408\u5e76\u5206\u652f\uff0c\u8bf7\u4f7f\u7528 git merge \u547d\u4ee4\uff0c\u5982 git merge new-branch\u3002<\/li>\n<\/ul>\n<p><strong>\u6807\u7b7e<\/strong><\/p>\n<ul>\n<li>\u6807\u7b7e\u662f\u4ed3\u5e93\u72b6\u6001\u7684\u6c38\u4e45\u6027\u6807\u8bb0\u3002<\/li>\n<li>\u8981\u521b\u5efa\u6807\u7b7e\uff0c\u8bf7\u4f7f\u7528 git tag \u547d\u4ee4\uff0c\u5982 git tag v1.0\u3002<\/li>\n<\/ul>\n<p><strong>\u4f7f\u7528\u5de5\u5177<\/strong><\/p>\n<ul>\n<li>\n<p>\u6709\u8bb8\u591a\u5de5\u5177\u53ef\u4ee5\u7b80\u5316 Git \u5de5\u4f5c\u6d41\u7a0b\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>GitHub Desktop<\/li>\n<li>GitKraken<\/li>\n<li>SourceTree<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4ed3\u5e93\u600e\u4e48\u7528\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 \u4ed3\u5e93\u662f\u4ee3\u7801\u548c\u6587\u4ef6\u7248\u672c\u5386\u53f2\u7684\u5b58\u50a8\u4f4d\u7f6e\uff0c\u7528\u4e8e\u8ddf\u8e2a\u66f4\u6539\u3001\u534f\u4f5c\u548c\u7ba1\u7406\u9879\u76ee\u7248\u672c\u3002\u8981\u4f7f\u7528 git \u4ed3\u5e93\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u521b\u5efa\u4ed3\u5e93\uff1a\u8fd0\u884c git init\u3002\u6dfb\u52a0\u6587\u4ef6\uff1a\u4f7f\u7528 git add \u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u3002\u63d0\u4ea4\u66f4\u6539\uff1a\u4f7f\u7528 git commit \u5c06\u6682\u5b58\u533a\u66f4\u6539\u5b58\u50a8\u5728\u4ed3\u5e93\u4e2d\u3002\u63a8\u9001\u66f4\u6539\uff1a\u4f7f\u7528 git push \u5c06\u66f4\u6539\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u3002\u62c9\u53d6\u66f4\u6539\uff1a\u4f7f\u7528 git pull \u4ece\u8fdc\u7a0b\u4ed3\u5e93\u83b7\u53d6\u66f4\u6539\u3002\u5206\u652f\uff1a\u4f7f\u7528 git branch \u521b\u5efa\u5206\u652f\u3002\u5408\u5e76\uff1a\u4f7f\u7528 git merge \u5c06\u4e0d\u540c\u5206\u652f\u7684\u66f4\u6539\u5408\u5e76\u3002\u6807\u8bb0\uff1a\u4f7f\u7528 git tag Git \u4ed3\u5e93\u8be6\u89e3 Git \u4ed3\u5e93\u662f\u4e00\u4e2a\u5b58\u50a8\u4ee3\u7801\u548c\u6587\u4ef6\u7248\u672c\u5386\u53f2\u7684\u4e2d\u592e\u4f4d\u7f6e\u3002\u5b83\u5141\u8bb8\u5f00\u53d1\u4eba\u5458\u8ddf\u8e2a\u4ee3\u7801\u7684\u66f4\u6539\u3001\u534f\u4f5c\u5de5\u4f5c\u5e76\u7ba1\u7406\u4e0d\u540c\u7248\u672c\u7684\u9879\u76ee\u3002 \u5982\u4f55\u4f7f\u7528 Git \u4ed3\u5e93\uff1a \u521b\u5efa\u4ed3\u5e93 \u5728\u60a8\u8981\u5b58\u50a8\u9879\u76ee\u7684\u76ee\u5f55\u4e2d\uff0c\u8fd0\u884c init \u547d\u4ee4\u3002 \u8fd9\u5c06\u5728\u8be5\u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2a .git \u6587\u4ef6\u5939\uff0c\u5176\u4e2d\u5305\u542b\u4ed3\u5e93\u7684\u5143\u6570\u636e\u3002 \u6dfb\u52a0\u6587\u4ef6 \u5c06\u6587\u4ef6\u6dfb\u52a0\u5230\u4ed3\u5e93\uff0c\u4f7f\u7528 git add \u547d\u4ee4\uff0c\u5982 git add README.md\u3002 \u8fd9\u5c06\u628a\u6587\u4ef6\u6dfb\u52a0\u5230\u201c\u6682\u5b58\u533a\u201d\uff0c\u51c6\u5907\u63d0\u4ea4\u3002 \u63d0\u4ea4\u66f4\u6539 \u8981\u5c06\u66f4\u6539\u6c38\u4e45\u5b58\u50a8\u5728\u4ed3\u5e93\u4e2d\uff0c\u8bf7\u4f7f\u7528 git commit \u547d\u4ee4\uff0c\u5982 git [&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-21521","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21521","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=21521"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21521\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}