{"id":21536,"date":"2024-11-19T08:35:08","date_gmt":"2024-11-19T00:35:08","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21536\/"},"modified":"2024-11-19T08:35:08","modified_gmt":"2024-11-19T00:35:08","slug":"git%e6%80%8e%e4%b9%88%e6%8b%89%e5%8f%96%e6%9c%80%e6%96%b0%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21536\/","title":{"rendered":"git\u600e\u4e48\u62c9\u53d6\u6700\u65b0\u4ee3\u7801"},"content":{"rendered":"<blockquote><p>\n  \u5982\u4f55\u4f7f\u7528 git \u62c9\u53d6\u6700\u65b0\u4ee3\u7801\uff1f\u524d\u63d0\u6761\u4ef6\uff1a \u514b\u9686\u76ee\u6807\u4ed3\u5e93\u5e76\u6dfb\u52a0\u8fdc\u7a0b\u4ed3\u5e93\u3002\u6b65\u9aa4\uff1a\u5bfc\u822a\u5230\u672c\u5730\u4ed3\u5e93\u76ee\u5f55\u3002\u8fd0\u884c git pull remote-name branch-name \u547d\u4ee4\uff0c\u66ff\u6362 remote-name \u548c branch-name \u4e3a\u8fdc\u7a0b\u4ed3\u5e93\u548c\u5206\u652f\u4fe1\u606f\u3002\u89e3\u51b3\u51b2\u7a81\uff08\u5982\u679c\u5b58\u5728\uff09\u3002\u63d0\u4ea4\u5408\u5e76\u63d0\u4ea4\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/30\/2024053023281398316.jpg\" class=\"aligncenter\" title=\"git\u600e\u4e48\u62c9\u53d6\u6700\u65b0\u4ee3\u7801\u63d2\u56fe\" alt=\"git\u600e\u4e48\u62c9\u53d6\u6700\u65b0\u4ee3\u7801\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4f7f\u7528 Git \u62c9\u53d6\u6700\u65b0\u4ee3\u7801<\/strong><\/p>\n<p>Git \u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u5141\u8bb8\u5f00\u53d1\u4eba\u5458\u8ddf\u8e2a\u4ee3\u7801\u66f4\u6539\u5e76\u534f\u540c\u5de5\u4f5c\u3002\u8981\u62c9\u53d6\u6700\u65b0\u4ee3\u7801\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>\u524d\u63d0\u6761\u4ef6\uff1a<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u5df2\u514b\u9686\u76ee\u6807\u4ed3\u5e93\u3002<\/li>\n<li>\u5df2\u5c06\u8fdc\u7a0b\u4ed3\u5e93\u6dfb\u52a0\u5230\u60a8\u7684\u3002<\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li> <strong>\u5bfc\u822a\u5230\u672c\u5730\u4ed3\u5e93\u76ee\u5f55\uff1a<\/strong><br \/>\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u5bfc\u822a\u5230\u672c\u5730\u4ed3\u5e93\u7684\u6839\u76ee\u5f55\u3002<\/li>\n<li>\n<p><strong>\u62c9\u53d6\u8fdc\u7a0b\u4ed3\u5e93\uff1a<\/strong><br \/>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git pull remote-name branch-name<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u66ff\u6362 remote-name \u4e3a\u8fdc\u7a0b\u4ed3\u5e93\u7684\u540d\u79f0\u3002<\/li>\n<li>\u66ff\u6362 branch-name \u4e3a\u8981\u62c9\u53d6\u7684\u5206\u652f\u540d\u79f0\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u5206\u652f\u540d\u79f0\uff0c\u5219\u5c06\u62c9\u53d6\u9ed8\u8ba4\u5206\u652f\uff08\u901a\u5e38\u662f main\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u89e3\u51b3\u51b2\u7a81\uff08\u5982\u679c\u5b58\u5728\uff09\uff1a<\/strong><br \/>\u5982\u679c\u672c\u5730\u4ed3\u5e93\u6709\u672a\u63d0\u4ea4\u7684\u66f4\u6539\u4e0e\u8fdc\u7a0b\u4ed3\u5e93\u7684\u66f4\u6539\u53d1\u751f\u51b2\u7a81\uff0c\u60a8\u9700\u8981\u89e3\u51b3\u51b2\u7a81\u3002Git \u4f1a\u5728\u7ec8\u7aef\u4e2d\u6253\u5370\u6709\u5173\u51b2\u7a81\u7684\u6587\u4ef6\u548c\u884c\u53f7\u7684\u4fe1\u606f\u3002\u624b\u52a8\u7f16\u8f91\u6587\u4ef6\u4ee5\u89e3\u51b3\u51b2\u7a81\uff0c\u7136\u540e\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6682\u5b58\u66f4\u6539\uff1a<\/p>\n<pre>git add file-name<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u63d0\u4ea4\u5408\u5e76\u63d0\u4ea4\uff1a<\/strong><br \/>\u4e00\u65e6\u60a8\u89e3\u51b3\u4e86\u6240\u6709\u51b2\u7a81\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u63d0\u4ea4\u5408\u5e76\u63d0\u4ea4\uff1a<\/p>\n<pre>git commit -m \"Merge remote branch\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ol>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u4ece\u540d\u4e3a upstream \u7684\u8fdc\u7a0b\u4ed3\u5e93\u62c9\u53d6 main \u5206\u652f\u5230\u540d\u4e3a my-project \u7684\u672c\u5730\u4ed3\u5e93\uff1a<\/p>\n<pre>git pull upstream main<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u60a8\u53ea\u60f3\u62c9\u53d6\u7279\u5b9a\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528  fetch \u547d\u4ee4\u3002<\/li>\n<li>\u62c9\u53d6\u6700\u65b0\u4ee3\u7801\u4e4b\u524d\uff0c\u5efa\u8bae\u5148\u8fd0\u884c git fetch \u4ee5\u83b7\u53d6\u8fdc\u7a0b\u4ed3\u5e93\u7684\u6700\u65b0\u72b6\u6001\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u62c9\u53d6\u6700\u65b0\u4ee3\u7801\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>\u5982\u4f55\u4f7f\u7528 git \u62c9\u53d6\u6700\u65b0\u4ee3\u7801\uff1f\u524d\u63d0\u6761\u4ef6\uff1a \u514b\u9686\u76ee\u6807\u4ed3\u5e93\u5e76\u6dfb\u52a0\u8fdc\u7a0b\u4ed3\u5e93\u3002\u6b65\u9aa4\uff1a\u5bfc\u822a\u5230\u672c\u5730\u4ed3\u5e93\u76ee\u5f55\u3002\u8fd0\u884c git pull remote-name branch-name \u547d\u4ee4\uff0c\u66ff\u6362 remote-name \u548c branch-name \u4e3a\u8fdc\u7a0b\u4ed3\u5e93\u548c\u5206\u652f\u4fe1\u606f\u3002\u89e3\u51b3\u51b2\u7a81\uff08\u5982\u679c\u5b58\u5728\uff09\u3002\u63d0\u4ea4\u5408\u5e76\u63d0\u4ea4\u3002 \u5982\u4f55\u4f7f\u7528 Git \u62c9\u53d6\u6700\u65b0\u4ee3\u7801 Git \u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u5141\u8bb8\u5f00\u53d1\u4eba\u5458\u8ddf\u8e2a\u4ee3\u7801\u66f4\u6539\u5e76\u534f\u540c\u5de5\u4f5c\u3002\u8981\u62c9\u53d6\u6700\u65b0\u4ee3\u7801\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a \u524d\u63d0\u6761\u4ef6\uff1a \u786e\u4fdd\u5df2\u514b\u9686\u76ee\u6807\u4ed3\u5e93\u3002 \u5df2\u5c06\u8fdc\u7a0b\u4ed3\u5e93\u6dfb\u52a0\u5230\u60a8\u7684\u3002 \u6b65\u9aa4\uff1a \u5bfc\u822a\u5230\u672c\u5730\u4ed3\u5e93\u76ee\u5f55\uff1a\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u5bfc\u822a\u5230\u672c\u5730\u4ed3\u5e93\u7684\u6839\u76ee\u5f55\u3002 \u62c9\u53d6\u8fdc\u7a0b\u4ed3\u5e93\uff1a\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a git pull remote-name branch-name \u767b\u5f55\u540e\u590d\u5236 \u66ff\u6362 remote-name \u4e3a\u8fdc\u7a0b\u4ed3\u5e93\u7684\u540d\u79f0\u3002 \u66ff\u6362 branch-name \u4e3a\u8981\u62c9\u53d6\u7684\u5206\u652f\u540d\u79f0\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u5206\u652f\u540d\u79f0\uff0c\u5219\u5c06\u62c9\u53d6\u9ed8\u8ba4\u5206\u652f\uff08\u901a\u5e38\u662f main\uff09\u3002 \u89e3\u51b3\u51b2\u7a81\uff08\u5982\u679c\u5b58\u5728\uff09\uff1a\u5982\u679c\u672c\u5730\u4ed3\u5e93\u6709\u672a\u63d0\u4ea4\u7684\u66f4\u6539\u4e0e\u8fdc\u7a0b\u4ed3\u5e93\u7684\u66f4\u6539\u53d1\u751f\u51b2\u7a81\uff0c\u60a8\u9700\u8981\u89e3\u51b3\u51b2\u7a81\u3002Git \u4f1a\u5728\u7ec8\u7aef\u4e2d\u6253\u5370\u6709\u5173\u51b2\u7a81\u7684\u6587\u4ef6\u548c\u884c\u53f7\u7684\u4fe1\u606f\u3002\u624b\u52a8\u7f16\u8f91\u6587\u4ef6\u4ee5\u89e3\u51b3\u51b2\u7a81\uff0c\u7136\u540e\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6682\u5b58\u66f4\u6539\uff1a git add file-name \u767b\u5f55\u540e\u590d\u5236 \u63d0\u4ea4\u5408\u5e76\u63d0\u4ea4\uff1a\u4e00\u65e6\u60a8\u89e3\u51b3\u4e86\u6240\u6709\u51b2\u7a81\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u63d0\u4ea4\u5408\u5e76\u63d0\u4ea4\uff1a git commit -m &#8220;Merge remote branch&#8221; \u767b\u5f55\u540e\u590d\u5236 \u793a\u4f8b\uff1a \u4ece\u540d\u4e3a upstream \u7684\u8fdc\u7a0b\u4ed3\u5e93\u62c9\u53d6 main [&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-21536","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21536","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=21536"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21536\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}