{"id":21533,"date":"2024-11-19T16:47:06","date_gmt":"2024-11-19T08:47:06","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21533\/"},"modified":"2024-11-19T16:47:06","modified_gmt":"2024-11-19T08:47:06","slug":"git%e6%80%8e%e4%b9%88%e6%9c%ac%e5%9c%b0%e5%90%88%e5%b9%b6%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21533\/","title":{"rendered":"git\u600e\u4e48\u672c\u5730\u5408\u5e76\u4ee3\u7801"},"content":{"rendered":"<blockquote><p>\n  \u8981\u672c\u5730\u5408\u5e76\u4ee3\u7801\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a1. \u83b7\u53d6\u8fdc\u7a0b\u66f4\u6539\uff1b2. \u521b\u5efa\u5408\u5e76\u63d0\u4ea4\uff1b3. \u89e3\u51b3\u51b2\u7a81\uff08\u5982\u6709\uff09\uff1b4. \u63d0\u4ea4\u5408\u5e76\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/30\/2024053023245930510.jpg\" class=\"aligncenter\" title=\"git\u600e\u4e48\u672c\u5730\u5408\u5e76\u4ee3\u7801\u63d2\u56fe\" alt=\"git\u600e\u4e48\u672c\u5730\u5408\u5e76\u4ee3\u7801\u63d2\u56fe\" \/><\/p>\n<p><strong>Git \u672c\u5730\u5408\u5e76\u4ee3\u7801<\/strong><\/p>\n<p><strong>\u5982\u4f55\u672c\u5730\u5408\u5e76\u4ee3\u7801\uff1f<\/strong><\/p>\n<p>\u8981\u672c\u5730\u5408\u5e76\u4ee3\u7801\uff0c\u8bf7\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li> <strong>\u786e\u4fdd\u4f60\u7684\u5de5\u4f5c\u526f\u672c\u662f\u6700\u65b0\u7684\uff1a<\/strong>\u4f7f\u7528  fetch \u547d\u4ee4\u83b7\u53d6\u8fdc\u7a0b\u4ed3\u5e93\u7684\u6700\u65b0\u66f4\u6539\u3002<\/li>\n<li> <strong>\u521b\u5efa\u5408\u5e76\u63d0\u4ea4\uff1a<\/strong>\u4f7f\u7528 git merge \u547d\u4ee4\u4e0e\u8981\u5408\u5e76\u7684\u5206\u652f\u5408\u5e76\u4f60\u7684\u5f53\u524d\u5206\u652f\u3002\u4f8b\u5982\uff1agit merge feature-branch\u3002<\/li>\n<li> <strong>\u89e3\u51b3\u51b2\u7a81\uff08\u5982\u6709\uff09\uff1a<\/strong>\u5982\u679c\u5408\u5e76\u5bfc\u81f4\u4efb\u4f55\u51b2\u7a81\uff0cGit \u5c06\u63d0\u793a\u4f60\u89e3\u51b3\u5b83\u4eec\u3002\u6253\u5f00\u51b2\u7a81\u6587\u4ef6\uff0c\u624b\u52a8\u89e3\u51b3\u51b2\u7a81\uff0c\u7136\u540e\u4f7f\u7528 git add \u547d\u4ee4\u6682\u5b58\u5df2\u89e3\u51b3\u7684\u51b2\u7a81\u3002<\/li>\n<li> <strong>\u63d0\u4ea4\u5408\u5e76\uff1a<\/strong>\u4e00\u65e6\u6240\u6709\u51b2\u7a81\u90fd\u5df2\u89e3\u51b3\uff0c\u4f7f\u7528 git commit \u547d\u4ee4\u63d0\u4ea4\u5408\u5e76\u3002<\/li>\n<\/ol>\n<p><strong>\u8be6\u7ec6\u89e3\u91ca\uff1a<\/strong><\/p>\n<p><strong>1. \u83b7\u53d6\u8fdc\u7a0b\u66f4\u6539<\/strong><\/p>\n<p>\u5728\u5408\u5e76\u4e4b\u524d\uff0c\u4f60\u9700\u8981\u786e\u4fdd\u4f60\u7684\u672c\u5730\u5de5\u4f5c\u526f\u672c\u5305\u542b\u8fdc\u7a0b\u4ed3\u5e93\u7684\u6700\u65b0\u66f4\u6539\u3002\u4f7f\u7528 git fetch \u547d\u4ee4\u4ece\u8fdc\u7a0b\u4ed3\u5e93\u83b7\u53d6\u8fd9\u4e9b\u66f4\u6539\uff1a<\/p>\n<pre>git fetch origin<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u521b\u5efa\u5408\u5e76\u63d0\u4ea4<\/strong><\/p>\n<p>\u8981\u5408\u5e76\u4ee3\u7801\uff0c\u8bf7\u4f7f\u7528 git merge \u547d\u4ee4\uff0c\u540e\u9762\u8ddf\u4f60\u8981\u5408\u5e76\u7684\u5206\u652f\u7684\u540d\u79f0\u3002\u4f8b\u5982\uff0c\u8981\u5408\u5e76 feature-branch \u5206\u652f\uff0c\u8bf7\u8fd0\u884c\uff1a<\/p>\n<pre>git merge feature-branch<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6b64\u547d\u4ee4\u5c06\u5c1d\u8bd5\u5c06 feature-branch \u5206\u652f\u4e2d\u7684\u66f4\u6539\u5408\u5e76\u5230\u4f60\u7684\u5f53\u524d\u5206\u652f\u4e2d\u3002<\/p>\n<p><strong>3. \u89e3\u51b3\u51b2\u7a81<\/strong><\/p>\n<p>\u5982\u679c\u5408\u5e76\u5bfc\u81f4\u4efb\u4f55\u51b2\u7a81\uff0cGit \u5c06\u63d0\u793a\u4f60\u89e3\u51b3\u5b83\u4eec\u3002\u51b2\u7a81\u53d1\u751f\u5728\u4e24\u4e2a\u5206\u652f\u5bf9\u540c\u4e00\u6587\u4ef6\u4e2d\u7684\u540c\u4e00\u884c\u8fdb\u884c\u66f4\u6539\u65f6\u3002<\/p>\n<ul>\n<li>\u6253\u5f00\u51b2\u7a81\u6587\u4ef6\uff0c\u624b\u52a8\u6bd4\u8f83\u66f4\u6539\u5e76\u89e3\u51b3\u51b2\u7a81\u3002<\/li>\n<li>\u4f7f\u7528 git add \u547d\u4ee4\u6682\u5b58\u5df2\u89e3\u51b3\u7684\u51b2\u7a81\u6587\u4ef6\uff1a<\/li>\n<\/ul>\n<pre>git add &lt;conflict-file&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u63d0\u4ea4\u5408\u5e76<\/strong><\/p>\n<p>\u4e00\u65e6\u6240\u6709\u51b2\u7a81\u90fd\u5df2\u89e3\u51b3\uff0c\u4f7f\u7528 git commit \u547d\u4ee4\u63d0\u4ea4\u5408\u5e76\uff1a<\/p>\n<pre>git commit -m \"Merge feature-branch\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6b64\u547d\u4ee4\u5c06\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u63d0\u4ea4\uff0c\u5c06\u6765\u81ea feature-branch \u5206\u652f\u7684\u66f4\u6539\u5408\u5e76\u5230\u4f60\u7684\u5f53\u524d\u5206\u652f\u4e2d\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u672c\u5730\u5408\u5e76\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>\u8981\u672c\u5730\u5408\u5e76\u4ee3\u7801\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a1. \u83b7\u53d6\u8fdc\u7a0b\u66f4\u6539\uff1b2. \u521b\u5efa\u5408\u5e76\u63d0\u4ea4\uff1b3. \u89e3\u51b3\u51b2\u7a81\uff08\u5982\u6709\uff09\uff1b4. \u63d0\u4ea4\u5408\u5e76\u3002 Git \u672c\u5730\u5408\u5e76\u4ee3\u7801 \u5982\u4f55\u672c\u5730\u5408\u5e76\u4ee3\u7801\uff1f \u8981\u672c\u5730\u5408\u5e76\u4ee3\u7801\uff0c\u8bf7\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a \u786e\u4fdd\u4f60\u7684\u5de5\u4f5c\u526f\u672c\u662f\u6700\u65b0\u7684\uff1a\u4f7f\u7528 fetch \u547d\u4ee4\u83b7\u53d6\u8fdc\u7a0b\u4ed3\u5e93\u7684\u6700\u65b0\u66f4\u6539\u3002 \u521b\u5efa\u5408\u5e76\u63d0\u4ea4\uff1a\u4f7f\u7528 git merge \u547d\u4ee4\u4e0e\u8981\u5408\u5e76\u7684\u5206\u652f\u5408\u5e76\u4f60\u7684\u5f53\u524d\u5206\u652f\u3002\u4f8b\u5982\uff1agit merge feature-branch\u3002 \u89e3\u51b3\u51b2\u7a81\uff08\u5982\u6709\uff09\uff1a\u5982\u679c\u5408\u5e76\u5bfc\u81f4\u4efb\u4f55\u51b2\u7a81\uff0cGit \u5c06\u63d0\u793a\u4f60\u89e3\u51b3\u5b83\u4eec\u3002\u6253\u5f00\u51b2\u7a81\u6587\u4ef6\uff0c\u624b\u52a8\u89e3\u51b3\u51b2\u7a81\uff0c\u7136\u540e\u4f7f\u7528 git add \u547d\u4ee4\u6682\u5b58\u5df2\u89e3\u51b3\u7684\u51b2\u7a81\u3002 \u63d0\u4ea4\u5408\u5e76\uff1a\u4e00\u65e6\u6240\u6709\u51b2\u7a81\u90fd\u5df2\u89e3\u51b3\uff0c\u4f7f\u7528 git commit \u547d\u4ee4\u63d0\u4ea4\u5408\u5e76\u3002 \u8be6\u7ec6\u89e3\u91ca\uff1a 1. \u83b7\u53d6\u8fdc\u7a0b\u66f4\u6539 \u5728\u5408\u5e76\u4e4b\u524d\uff0c\u4f60\u9700\u8981\u786e\u4fdd\u4f60\u7684\u672c\u5730\u5de5\u4f5c\u526f\u672c\u5305\u542b\u8fdc\u7a0b\u4ed3\u5e93\u7684\u6700\u65b0\u66f4\u6539\u3002\u4f7f\u7528 git fetch \u547d\u4ee4\u4ece\u8fdc\u7a0b\u4ed3\u5e93\u83b7\u53d6\u8fd9\u4e9b\u66f4\u6539\uff1a git fetch origin \u767b\u5f55\u540e\u590d\u5236 2. \u521b\u5efa\u5408\u5e76\u63d0\u4ea4 \u8981\u5408\u5e76\u4ee3\u7801\uff0c\u8bf7\u4f7f\u7528 git merge \u547d\u4ee4\uff0c\u540e\u9762\u8ddf\u4f60\u8981\u5408\u5e76\u7684\u5206\u652f\u7684\u540d\u79f0\u3002\u4f8b\u5982\uff0c\u8981\u5408\u5e76 feature-branch \u5206\u652f\uff0c\u8bf7\u8fd0\u884c\uff1a git merge feature-branch \u767b\u5f55\u540e\u590d\u5236 \u6b64\u547d\u4ee4\u5c06\u5c1d\u8bd5\u5c06 feature-branch \u5206\u652f\u4e2d\u7684\u66f4\u6539\u5408\u5e76\u5230\u4f60\u7684\u5f53\u524d\u5206\u652f\u4e2d\u3002 3. \u89e3\u51b3\u51b2\u7a81 [&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-21533","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21533","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=21533"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21533\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}