{"id":16931,"date":"2025-02-14T14:47:43","date_gmt":"2025-02-14T06:47:43","guid":{"rendered":"https:\/\/92it.top\/?p=16931"},"modified":"2025-02-14T14:47:59","modified_gmt":"2025-02-14T06:47:59","slug":"%e4%bb%80%e4%b9%88%e6%98%af-git-pull-request-pr%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=16931","title":{"rendered":"\u4ec0\u4e48\u662f Git Pull Request (PR)\uff1f"},"content":{"rendered":"\n<p><strong>Pull Request\uff08PR\uff0c\u5408\u5e76\u8bf7\u6c42\uff09<\/strong> \u662f GitHub\u3001GitLab\u3001Bitbucket \u7b49\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\u63d0\u4f9b\u7684\u4e00\u79cd\u4ee3\u7801\u534f\u4f5c\u65b9\u5f0f\u3002<\/p>\n\n\n\n<p>\ud83d\udccc <strong>\u7b80\u5355\u7406\u89e3<\/strong>\uff1a<\/p>\n\n\n\n<ol>\n<li><strong>\u4f60<\/strong> \u5728 <strong>fork<\/strong> \u6216 <strong>\u81ea\u5df1\u7684\u5206\u652f<\/strong> \u4e0a\u505a\u4e86\u4e00\u4e9b\u4ee3\u7801\u4fee\u6539\u3002<\/li>\n\n\n\n<li>\u4f60\u5e0c\u671b\u628a\u8fd9\u4e9b\u4fee\u6539\u5408\u5e76\u5230\u4e3b\u9879\u76ee\uff08\u5982 <code>main<\/code> \u6216 <code>develop<\/code> \u5206\u652f\uff09\u3002<\/li>\n\n\n\n<li>\u4f60\u53d1\u8d77\u4e00\u4e2a <strong>Pull Request\uff08PR\uff09<\/strong>\uff0c\u8bf7\u6c42\u9879\u76ee\u7ef4\u62a4\u8005\u5ba1\u6838\u5e76\u5408\u5e76\u4f60\u7684\u4ee3\u7801\u3002<\/li>\n<\/ol>\n\n\n\n<p>PR \u4e0d\u662f Git \u672c\u8eab\u7684\u529f\u80fd\uff0c\u800c\u662f\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\u63d0\u4f9b\u7684<strong>\u4ee3\u7801\u5ba1\u67e5\u673a\u5236<\/strong>\u3002<\/p>\n\n\n\n<p><strong>\u8d21\u732e PR \u662f\u4ec0\u4e48\u610f\u601d\uff1f<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\u8d21\u732e PR<\/strong>\uff08\u8d21\u732e Pull Request\uff09\u6307\u7684\u662f\uff1a<br>\u4f60\u5411\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\u6216\u56e2\u961f\u7684\u4ee3\u7801\u4ed3\u5e93\u63d0\u4ea4\u4ee3\u7801\uff0c\u5e76\u901a\u8fc7 PR <strong>\u8bf7\u6c42\u5408\u5e76\u4f60\u7684\u4ee3\u7801\u8d21\u732e<\/strong>\u3002<\/p>\n\n\n\n<p>\ud83d\udccc <strong>\u8d21\u732e PR \u7684\u5178\u578b\u6d41\u7a0b<\/strong>\uff1a<\/p>\n\n\n\n<ol>\n<li><strong>Fork \u4ed3\u5e93<\/strong>\uff1a\n<ul>\n<li>\u5148 Fork\uff08\u514b\u9686\uff09\u76ee\u6807\u4ed3\u5e93\u5230\u81ea\u5df1\u7684 GitHub \u8d26\u53f7\u3002<\/li>\n\n\n\n<li>\u8fd9\u6837\u4f60\u6709\u4e86\u4e00\u4e2a\u81ea\u5df1\u53ef\u4ee5\u81ea\u7531\u4fee\u6539\u7684\u7248\u672c\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u521b\u5efa\u65b0\u5206\u652f\u5e76\u5f00\u53d1<\/strong>\uff1a<\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git checkout -b feature-new<\/pre>\n\n\n\n<ul>\n<li>\u5728\u81ea\u5df1\u7684\u5206\u652f <code>feature-new<\/code> \u4e0a\u8fdb\u884c\u4ee3\u7801\u4fee\u6539\u548c\u63d0\u4ea4\u3002<\/li>\n<\/ul>\n\n\n\n<ul>\n<li>\u63d0\u4ea4\u4ee3\u7801\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git add .\ngit commit -m \"\u6dfb\u52a0\u4e86\u67d0\u67d0\u65b0\u529f\u80fd\"\n<\/pre>\n\n\n\n<p>3.<strong>\u63a8\u9001\u5230\u81ea\u5df1 Fork \u7684\u4ed3\u5e93<\/strong>\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git push origin feature-new<\/pre>\n\n\n\n<p>4.<strong>\u521b\u5efa Pull Request\uff08PR\uff09<\/strong>\uff1a<\/p>\n\n\n\n<ul>\n<li>\u5728 GitHub\/GitLab \u4e0a\uff0c\u8fdb\u5165 Fork \u4e4b\u540e\u7684\u4ed3\u5e93\u3002<\/li>\n\n\n\n<li>\u70b9\u51fb\u201c<strong>Compare &amp; pull request<\/strong>\u201d\u3002<\/li>\n\n\n\n<li>\u586b\u5199 PR \u8bf4\u660e\uff0c\u63cf\u8ff0\u4f60\u7684\u4fee\u6539\u5185\u5bb9\u3002<\/li>\n<\/ul>\n\n\n\n<p>5.<strong>\u7b49\u5f85\u7ef4\u62a4\u8005\u5ba1\u6838\u548c\u5408\u5e76<\/strong>\uff1a<\/p>\n\n\n\n<ul>\n<li>\u7ef4\u62a4\u8005\u4f1a\u67e5\u770b PR \u4ee3\u7801\uff0c\u5982\u679c\u6709\u95ee\u9898\u53ef\u80fd\u4f1a\u8981\u6c42\u4fee\u6539\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u901a\u8fc7\u5ba1\u6838\uff0c\u7ef4\u62a4\u8005\u4f1a\u5408\u5e76 PR\uff0c\u4f60\u7684\u4ee3\u7801\u5c31\u6b63\u5f0f\u8fdb\u5165\u4e3b\u4ed3\u5e93\uff01<\/li>\n<\/ul>\n\n\n\n<p><strong>PR \u548c\u76f4\u63a5 <code>git push<\/code> \u5230\u4e3b\u4ed3\u5e93\u7684\u533a\u522b\uff1f<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<ul>\n<li><strong>PR \u65b9\u5f0f\uff08\u63a8\u8350\uff09<\/strong>\uff1a\n<ul>\n<li>\u9002\u7528\u4e8e\u56e2\u961f\u534f\u4f5c\u548c\u5f00\u6e90\u8d21\u732e\uff0c\u5141\u8bb8\u4ee3\u7801\u5ba1\u67e5\uff0c\u4fdd\u8bc1\u4ee3\u7801\u8d28\u91cf\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u76f4\u63a5 <code>git push<\/code> \u5230\u4e3b\u4ed3\u5e93<\/strong>\uff1a\n<ul>\n<li>\u53ea\u6709\u6709\u6743\u9650\u7684\u4eba\uff08\u5982\u7ba1\u7406\u5458\uff09\u624d\u80fd\u76f4\u63a5 push \u5230\u4e3b\u4ed3\u5e93\uff0c\u9002\u7528\u4e8e\u5c0f\u56e2\u961f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p><strong>\u5728\u5927\u591a\u6570\u5f00\u6e90\u9879\u76ee\u4e2d\uff0c\u4f60\u4e0d\u80fd\u76f4\u63a5 push \u4ee3\u7801\uff0c\u5fc5\u987b\u901a\u8fc7 PR \u63d0\u4ea4\u4ee3\u7801\u3002<\/strong><\/p>\n\n\n\n<p>\u2705 <strong>Git Pull Request\uff08PR\uff09<\/strong> \u662f GitHub\/GitLab \u7b49\u5e73\u53f0\u7684\u4ee3\u7801\u8d21\u732e\u65b9\u5f0f\uff0c\u4e3b\u8981\u7528\u4e8e\u4ee3\u7801\u5ba1\u6838\u548c\u5408\u5e76\u3002<br>\u2705 <strong>\u8d21\u732e PR<\/strong> \u6307\u7684\u662f\u5411\u5f00\u6e90\u9879\u76ee\u6216\u56e2\u961f\u4ee3\u7801\u4ed3\u5e93\u63d0\u4ea4\u4ee3\u7801\uff0c\u5e2e\u52a9\u6539\u8fdb\u9879\u76ee\u3002<br>\u2705 <strong>PR \u9700\u8981\u7ef4\u62a4\u8005\u5ba1\u6838\u540e\u624d\u80fd\u5408\u5e76\u5230\u4e3b\u5206\u652f<\/strong>\uff0c\u56e0\u6b64\u662f\u6807\u51c6\u7684\u56e2\u961f\u534f\u4f5c\u65b9\u5f0f\u3002<\/p>\n\n\n\n<p><strong>\u4e3a\u4ec0\u4e48\u8981\u5148 Fork\uff1fFork \u548c Clone \u6709\u4ec0\u4e48\u533a\u522b\uff1f<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5728 GitHub\u3001GitLab \u6216 Bitbucket \u4e0a\uff0c<strong>Fork<\/strong> \u548c <strong>Clone<\/strong> \u662f\u4e24\u79cd\u4e0d\u540c\u7684\u4ee3\u7801\u83b7\u53d6\u65b9\u5f0f\uff0c\u9002\u7528\u4e8e\u4e0d\u540c\u7684\u4f7f\u7528\u573a\u666f\u3002<\/p>\n\n\n\n<p><strong>1. \u4ec0\u4e48\u662f Fork\uff1f<\/strong><\/p>\n\n\n\n<p><strong>Fork\uff08\u6d3e\u751f\/\u514b\u9686\u5230\u81ea\u5df1\u7684\u8d26\u53f7\uff09<\/strong> \u662f\u5728 <strong>GitHub\/GitLab<\/strong> \u4e0a\u521b\u5efa\u4e00\u4e2a\u9879\u76ee\u7684 <strong>\u526f\u672c<\/strong>\uff0c\u5b58\u653e\u5728<strong>\u81ea\u5df1\u7684\u4ee3\u7801\u4ed3\u5e93<\/strong>\u91cc\u3002<\/p>\n\n\n\n<p>\ud83d\udd39 <strong>Fork \u9002\u7528\u4e8e<\/strong>\uff1a<br>\u2705 <strong>\u5f00\u6e90\u8d21\u732e<\/strong>\uff1a\u4f60\u60f3\u4fee\u6539\u522b\u4eba\u7684\u5f00\u6e90\u9879\u76ee\uff0c\u4f46\u6ca1\u6709\u76f4\u63a5 Push \u6743\u9650\uff0c\u6240\u4ee5\u5fc5\u987b Fork \u540e\u518d\u63d0\u4ea4 PR\u3002<br>\u2705 <strong>\u5b89\u5168\u6027<\/strong>\uff1aFork \u540e\u7684\u4ee3\u7801\u4e0d\u4f1a\u76f4\u63a5\u5f71\u54cd\u539f\u4ed3\u5e93\uff0c\u53ea\u6709 PR \u901a\u8fc7\u540e\u624d\u4f1a\u5408\u5e76\u3002<br>\u2705 <strong>\u4e2a\u4eba\u4fee\u6539<\/strong>\uff1a\u4f60\u60f3\u5728 GitHub \u4e0a\u4fdd\u7559\u67d0\u4e2a\u9879\u76ee\u7684\u526f\u672c\uff0c\u65b9\u4fbf\u81ea\u5df1\u6539\u52a8\u3002<\/p>\n\n\n\n<p>\ud83d\udccc <strong>\u793a\u4f8b\uff1aFork \u4e00\u4e2a\u5f00\u6e90\u9879\u76ee<\/strong><\/p>\n\n\n\n<ul>\n<li>\u5728 GitHub\/GitLab \u4e0a\u6253\u5f00\u67d0\u4e2a\u5f00\u6e90\u9879\u76ee\uff08\u4f8b\u5982 <code>https:\/\/github.com\/someone\/project<\/code>\uff09\u3002<\/li>\n\n\n\n<li>\u70b9\u51fb <strong>Fork<\/strong>\uff0cGitHub \u4f1a\u5728<strong>\u4f60\u7684\u8d26\u53f7<\/strong>\u4e0b\u521b\u5efa\u4e00\u4e2a\u526f\u672c\uff08<code>https:\/\/github.com\/your-username\/project<\/code>\uff09\u3002<\/li>\n\n\n\n<li><strong>\u514b\u9686 Fork \u7684\u4ed3\u5e93<\/strong> \u5230\u672c\u5730\u5f00\u53d1\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git clone https:\/\/github.com\/your-username\/project.git<\/pre>\n\n\n\n<ul>\n<li><strong>\u63d0\u4ea4 Pull Request\uff08PR\uff09<\/strong>\uff0c\u8bf7\u6c42\u5408\u5e76\u5230\u539f\u59cb\u9879\u76ee\u3002<\/li>\n\n\n\n<li><strong>\u4fee\u6539\u4ee3\u7801\uff0c\u63d0\u4ea4\u5230\u81ea\u5df1\u7684\u4ed3\u5e93<\/strong>\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git add .\ngit commit -m \"\u4fee\u6539\u4e86\u67d0\u67d0\u529f\u80fd\"\ngit push origin main<\/pre>\n\n\n\n<ul>\n<li><strong>\u63d0\u4ea4 Pull Request\uff08PR\uff09<\/strong>\uff0c\u8bf7\u6c42\u5408\u5e76\u5230\u539f\u59cb\u9879\u76ee\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>2. \u4ec0\u4e48\u662f Clone\uff1f<\/strong><\/p>\n\n\n\n<p><strong>Clone\uff08\u514b\u9686\uff09<\/strong> \u662f<strong>\u628a\u8fdc\u7a0b\u4ed3\u5e93\u7684\u4ee3\u7801\u4e0b\u8f7d\u5230\u672c\u5730<\/strong>\uff0c\u7528\u4e8e\u672c\u5730\u5f00\u53d1\u3002<\/p>\n\n\n\n<p>\ud83d\udd39 <strong>Clone \u9002\u7528\u4e8e<\/strong>\uff1a<br>\u2705 \u4f60\u6709\u6743\u9650\u76f4\u63a5 Push \u4ee3\u7801\uff08\u5982\u516c\u53f8\u56e2\u961f\u9879\u76ee\uff09\u3002<br>\u2705 \u4f60\u53ea\u662f\u60f3\u8fd0\u884c\u4ee3\u7801\uff0c\u5e76\u4e0d\u6253\u7b97\u63d0\u4ea4\u66f4\u6539\uff08\u6bd4\u5982\u5b66\u4e60\u522b\u4eba\u9879\u76ee\u7684\u4ee3\u7801\uff09\u3002<br>\u2705 \u4f60\u5df2\u7ecf Fork \u4e86\u9879\u76ee\uff0c\u73b0\u5728\u8981\u514b\u9686\u5b83\u5230\u672c\u5730\u8fdb\u884c\u5f00\u53d1\u3002<\/p>\n\n\n\n<p>\ud83d\udccc <strong>\u793a\u4f8b\uff1aClone \u4ee3\u7801<\/strong><br>\u5982\u679c\u4f60\u6709\u6743\u9650\u76f4\u63a5\u4fee\u6539\u67d0\u4e2a GitHub \u9879\u76ee\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5 Clone\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git clone https:\/\/github.com\/someone\/project.git<\/pre>\n\n\n\n<p><strong>3. Fork \u548c Clone \u7684\u533a\u522b<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"358\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/02\/image-25-1024x358.png\" alt=\"\" class=\"wp-image-16933\" style=\"width:592px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/02\/image-25-1024x358.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/02\/image-25-300x105.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/02\/image-25-768x269.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/02\/image-25-1536x537.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2025\/02\/image-25-830x290.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/02\/image-25-230x80.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/02\/image-25-350x122.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/02\/image-25-480x168.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/02\/image-25.png 1572w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p><strong>4. \u4ec0\u4e48\u65f6\u5019\u7528 Fork\uff1f\u4ec0\u4e48\u65f6\u5019\u7528 Clone\uff1f<\/strong><\/p>\n\n\n\n<p>\u2705 <strong>\u5982\u679c\u4f60\u662f\u5f00\u6e90\u9879\u76ee\u7684\u5916\u90e8\u8d21\u732e\u8005<\/strong>\uff08\u6ca1\u6709\u76f4\u63a5 Push \u6743\u9650\uff09\uff1a<strong>Fork + Clone<\/strong><br>\u2705 <strong>\u5982\u679c\u4f60\u662f\u56e2\u961f\u6210\u5458\uff0c\u6709\u6743\u9650\u76f4\u63a5\u4fee\u6539\u4ee3\u7801<\/strong>\uff1a\u76f4\u63a5 <strong>Clone<\/strong><br>\u2705 <strong>\u5982\u679c\u4f60\u53ea\u662f\u60f3\u4e0b\u8f7d\u4ee3\u7801\uff0c\u770b\u770b\u6216\u8fd0\u884c\u4e00\u4e0b<\/strong>\uff1a\u76f4\u63a5 <strong>Clone<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pull Request\uff08PR\uff0c\u5408\u5e76\u8bf7\u6c42\uff09 \u662f GitHub\u3001GitLab\u3001Bitbucket \u7b49\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/16931"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16931"}],"version-history":[{"count":2,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/16931\/revisions"}],"predecessor-version":[{"id":16934,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/16931\/revisions\/16934"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16931"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16931"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}