{"id":20417,"date":"2024-11-19T14:19:19","date_gmt":"2024-11-19T06:19:19","guid":{"rendered":"https:\/\/fwq.ai\/blog\/20417\/"},"modified":"2024-11-19T14:19:19","modified_gmt":"2024-11-19T06:19:19","slug":"%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8gitlab%e8%bf%9b%e8%a1%8c%e5%a4%9a%e5%88%86%e6%94%af%e5%bc%80%e5%8f%91%e5%92%8c%e5%8f%91%e5%b8%83","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/20417\/","title":{"rendered":"\u5982\u4f55\u5229\u7528GitLab\u8fdb\u884c\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/164\/169812020184829.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5229\u7528GitLab\u8fdb\u884c\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03\u63d2\u56fe\" alt=\"\u5982\u4f55\u5229\u7528GitLab\u8fdb\u884c\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03\u63d2\u56fe\" \/><\/p>\n<p>\u5982\u4f55\u5229\u7528GitLab\u8fdb\u884c\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03<\/p>\n<p>GitLab\u662f\u4e00\u6b3e\u975e\u5e38\u6d41\u884c\u7684\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\u548c\u5de5\u5177\uff0c\u65b9\u4fbf\u56e2\u961f\u534f\u4f5c\u5f00\u53d1\u3002\u5176\u4e2d\uff0c\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03\u662fGitLab\u7684\u6838\u5fc3\u529f\u80fd\u4e4b\u4e00\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728GitLab\u4e0a\u8fdb\u884c\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03\uff0c\u5e76\u63d0\u4f9b\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\u3002<\/p>\n<p>\u4e00\u3001\u521b\u5efa\u9879\u76ee\u548c\u5206\u652f<\/p>\n<p>\u9996\u5148\uff0c\u767b\u5f55\u5230GitLab\u5e76\u521b\u5efa\u4e00\u4e2a\u65b0\u9879\u76ee\u3002\u5728\u9879\u76ee\u9875\u9762\u4e2d\uff0c\u627e\u5230\u201cBranch\u201d\uff08\u5206\u652f\uff09\u9009\u9879\u5361\uff0c\u70b9\u51fb\u201cNew branch\u201d\uff08\u65b0\u5efa\u5206\u652f\uff09\u6309\u94ae\u3002\u8f93\u5165\u5206\u652f\u540d\u5b57\uff0c\u7136\u540e\u70b9\u51fb\u201cCreate branch\u201d\uff08\u521b\u5efa\u5206\u652f\uff09\u6309\u94ae\u5373\u53ef\u3002<\/p>\n<p>\u4e8c\u3001\u591a\u5206\u652f\u5f00\u53d1<\/p>\n<p>\u5728\u9879\u76ee\u4e2d\u8fdb\u884c\u591a\u5206\u652f\u5f00\u53d1\u65f6\uff0c\u901a\u5e38\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u5f00\u53d1\u5206\u652f\uff08\u4f8b\u5982\uff1adev\uff09\u548c\u591a\u4e2a\u7279\u6027\u5206\u652f\uff08\u4f8b\u5982\uff1afeature1\u3001 feature2\u7b49\uff09\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<ol>\n<li>\n<p>\u521b\u5efa\u5f00\u53d1\u5206\u652f\uff1a<\/p>\n<pre>git checkout -b dev\ngit push origin dev<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/li>\n<li>\n<p>\u521b\u5efa\u7279\u6027\u5206\u652f\uff1a<\/p>\n<pre>git checkout -b feature1\ngit push origin feature1\n\ngit checkout -b feature2\ngit push origin feature2<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/li>\n<li>\n<p>\u5728\u7279\u6027\u5206\u652f\u4e0a\u8fdb\u884c\u5f00\u53d1\uff1a<\/p>\n<pre>git checkout feature1\n# \u5728feature1\u5206\u652f\u4e0a\u8fdb\u884c\u4ee3\u7801\u4fee\u6539\u548c\u63d0\u4ea4\ngit commit -am \"Add feature1\"\n\ngit checkout feature2\n# \u5728feature2\u5206\u652f\u4e0a\u8fdb\u884c\u4ee3\u7801\u4fee\u6539\u548c\u63d0\u4ea4\ngit commit -am \"Add feature2\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/li>\n<li>\n<p>\u5c06\u7279\u6027\u5206\u652f\u5408\u5e76\u5230\u5f00\u53d1\u5206\u652f\uff1a<\/p>\n<pre>git checkout dev\ngit merge feature1\ngit merge feature2<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/li>\n<li>\n<p>\u63a8\u9001\u5f00\u53d1\u5206\u652f\u81f3\u8fdc\u7a0b\u4ed3\u5e93\uff1a<\/p>\n<pre>git push origin dev<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/li>\n<\/ol>\n<p>\u4e09\u3001\u591a\u5206\u652f\u53d1\u5e03<\/p>\n<p>\u5728\u591a\u5206\u652f\u5f00\u53d1\u5b8c\u6210\u540e\uff0c\u901a\u5e38\u9700\u8981\u5c06\u4ee3\u7801\u53d1\u5e03\u5230\u7ebf\u4e0a\u73af\u5883\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<ol>\n<li>\n<p>\u521b\u5efa\u53d1\u5e03\u5206\u652f\uff08\u4f8b\u5982\uff1arelease\uff09\uff1a<\/p>\n<pre>git checkout -b release\ngit push origin release<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/li>\n<li>\n<p>\u5728\u53d1\u5e03\u5206\u652f\u4e0a\u8fdb\u884c\u4ee3\u7801\u6d4b\u8bd5\u548c\u4fee\u590d\uff1a<\/p>\n<pre>git checkout release\n# \u5728release\u5206\u652f\u4e0a\u8fdb\u884c\u6d4b\u8bd5\u548c\u4fee\u590d\ngit commit -am \"Fix bug\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/li>\n<li>\n<p>\u5c06\u53d1\u5e03\u5206\u652f\u5408\u5e76\u5230\u4e3b\u5206\u652f\uff08\u4f8b\u5982\uff1amaster\uff09\uff1a<\/p>\n<pre>git checkout master\ngit merge release<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/li>\n<li>\n<p>\u6807\u8bb0\u53d1\u5e03\u7248\u672c\uff1a<\/p>\n<pre>git tag v1.0.0\ngit push origin v1.0.0<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/li>\n<li>\n<p>\u63a8\u9001\u4e3b\u5206\u652f\u81f3\u8fdc\u7a0b\u4ed3\u5e93\uff1a<\/p>\n<pre>git push origin master<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/li>\n<\/ol>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03\u7684\u65b9\u5f0f\uff0c\u5b9e\u73b0\u4ee3\u7801\u7684\u9ad8\u5ea6\u53ef\u8ffd\u6eaf\u6027\u548c\u7075\u6d3b\u6027\u3002\u540c\u65f6\uff0cGitLab\u7684\u7248\u672c\u63a7\u5236\u529f\u80fd\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u7ba1\u7406\u4e0d\u540c\u5206\u652f\u7684\u4ee3\u7801\u53d8\u66f4\uff0c\u63d0\u9ad8\u56e2\u961f\u7684\u534f\u4f5c\u6548\u7387\u3002<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u5229\u7528GitLab\u8fdb\u884c\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03\uff0c\u5e76\u63d0\u4f9b\u4e86\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\u3002\u901a\u8fc7\u5408\u7406\u4f7f\u7528\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03\uff0c\u6211\u4eec\u53ef\u4ee5\u66f4\u597d\u5730\u7ba1\u7406\u4ee3\u7801\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff0c\u4fdd\u8bc1\u4ee3\u7801\u8d28\u91cf\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u5927\u5bb6\u80fd\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5229\u7528GitLab\u8fdb\u884c\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03\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\u5229\u7528GitLab\u8fdb\u884c\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03 GitLab\u662f\u4e00\u6b3e\u975e\u5e38\u6d41\u884c\u7684\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\u548c\u5de5\u5177\uff0c\u65b9\u4fbf\u56e2\u961f\u534f\u4f5c\u5f00\u53d1\u3002\u5176\u4e2d\uff0c\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03\u662fGitLab\u7684\u6838\u5fc3\u529f\u80fd\u4e4b\u4e00\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728GitLab\u4e0a\u8fdb\u884c\u591a\u5206\u652f\u5f00\u53d1\u548c\u53d1\u5e03\uff0c\u5e76\u63d0\u4f9b\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\u3002 \u4e00\u3001\u521b\u5efa\u9879\u76ee\u548c\u5206\u652f \u9996\u5148\uff0c\u767b\u5f55\u5230GitLab\u5e76\u521b\u5efa\u4e00\u4e2a\u65b0\u9879\u76ee\u3002\u5728\u9879\u76ee\u9875\u9762\u4e2d\uff0c\u627e\u5230\u201cBranch\u201d\uff08\u5206\u652f\uff09\u9009\u9879\u5361\uff0c\u70b9\u51fb\u201cNew branch\u201d\uff08\u65b0\u5efa\u5206\u652f\uff09\u6309\u94ae\u3002\u8f93\u5165\u5206\u652f\u540d\u5b57\uff0c\u7136\u540e\u70b9\u51fb\u201cCreate branch\u201d\uff08\u521b\u5efa\u5206\u652f\uff09\u6309\u94ae\u5373\u53ef\u3002 \u4e8c\u3001\u591a\u5206\u652f\u5f00\u53d1 \u5728\u9879\u76ee\u4e2d\u8fdb\u884c\u591a\u5206\u652f\u5f00\u53d1\u65f6\uff0c\u901a\u5e38\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u5f00\u53d1\u5206\u652f\uff08\u4f8b\u5982\uff1adev\uff09\u548c\u591a\u4e2a\u7279\u6027\u5206\u652f\uff08\u4f8b\u5982\uff1afeature1\u3001 feature2\u7b49\uff09\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff1a \u521b\u5efa\u5f00\u53d1\u5206\u652f\uff1a git checkout -b dev git push origin dev \u767b\u5f55\u540e\u590d\u5236 \u521b\u5efa\u7279\u6027\u5206\u652f\uff1a git checkout -b feature1 git push origin feature1 git checkout -b feature2 git push origin feature2 \u767b\u5f55\u540e\u590d\u5236 \u5728\u7279\u6027\u5206\u652f\u4e0a\u8fdb\u884c\u5f00\u53d1\uff1a git checkout feature1 # \u5728feature1\u5206\u652f\u4e0a\u8fdb\u884c\u4ee3\u7801\u4fee\u6539\u548c\u63d0\u4ea4 git commit -am &#8220;Add feature1&#8221; git checkout feature2 # \u5728feature2\u5206\u652f\u4e0a\u8fdb\u884c\u4ee3\u7801\u4fee\u6539\u548c\u63d0\u4ea4 git commit [&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-20417","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20417","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=20417"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20417\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=20417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=20417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=20417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}