{"id":19557,"date":"2024-11-19T09:34:48","date_gmt":"2024-11-19T01:34:48","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19557\/"},"modified":"2024-11-19T09:34:48","modified_gmt":"2024-11-19T01:34:48","slug":"%e3%80%90%e6%95%b4%e7%90%86%e5%88%86%e4%ba%ab%e3%80%91%e4%b8%80%e4%ba%9b%e5%b8%b8%e7%94%a8%e7%9a%84-gitlab-%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19557\/","title":{"rendered":"\u3010\u6574\u7406\u5206\u4eab\u3011\u4e00\u4e9b\u5e38\u7528\u7684 GitLab \u547d\u4ee4"},"content":{"rendered":"<p>gitlab \u547d\u4ee4\u662f\u5728 git \u4e2d\u4f7f\u7528\u7684\uff0c\u5b83\u662f\u4e00\u4e2a\u57fa\u4e8e git \u4ee3\u7801\u7ba1\u7406\u7cfb\u7edf\u7684 web \u5e94\u7528\u7a0b\u5e8f\uff0c\u63d0\u4f9b\u6e90\u4ee3\u7801\u7ba1\u7406\u3001\u9879\u76ee\u534f\u4f5c\u3001\u6301\u7eed\u96c6\u6210\u548c\u90e8\u7f72\u7b49\u529f\u80fd\u3002\u5b83\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u6765\u7ba1\u7406\u5927\u578b\u56e2\u961f\u7684\u4ee3\u7801\u5e93\u3002<\/p>\n<p>GitLab \u7684\u4f7f\u7528\u65b9\u6cd5\u5f88\u7b80\u5355\uff0c\u53ef\u4ee5\u901a\u8fc7 Git \u547d\u4ee4\u884c\u6216\u8005 GitLab \u7684\u56fe\u5f62\u5316\u754c\u9762\u6765\u8fdb\u884c\u64cd\u4f5c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684 GitLab \u547d\u4ee4:<\/p>\n<ol>\n<li>git clone git@gitlab.com:your_username\/your_project.git<\/li>\n<\/ol>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u7528\u4e8e\u5c06\u4e00\u4e2a GitLab \u4e0a\u7684\u9879\u76ee\u590d\u5236\u5230\u672c\u5730\u8ba1\u7b97\u673a\u4e0a\u3002\u5176\u4e2d git@gitlab.com:your_username\/your_project.git \u662f\u4f60\u9879\u76ee\u7684\u5730\u5740\u3002<\/p>\n<ol>\n<li>git add .<\/li>\n<\/ol>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u7528\u4e8e\u5c06\u672c\u5730\u4fee\u6539\u7684\u4ee3\u7801\u6dfb\u52a0\u5230 GitLab \u7684\u7248\u672c\u5e93\u4e2d\u3002&#8221;.&#8221; \u7684\u610f\u601d\u662f\u5c06\u5f53\u524d\u76ee\u5f55\u4e0b\u6240\u6709\u4fee\u6539\u7684\u6587\u4ef6\u90fd\u6dfb\u52a0\u5230\u7248\u672c\u5e93\u4e2d\u3002<\/p>\n<ol>\n<li>git commit -m &#8220;commit message&#8221;<\/li>\n<\/ol>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u7528\u4e8e\u5c06\u6dfb\u52a0\u5230 GitLab \u7248\u672c\u5e93\u4e2d\u7684\u4ee3\u7801\u63d0\u4ea4\uff0c\u5e76\u4e14\u6dfb\u52a0 commit message \u8bf4\u660e\u672c\u6b21\u63d0\u4ea4\u505a\u4e86\u4ec0\u4e48\u4fee\u6539\u3002<\/p>\n<ol>\n<li>git push origin master<\/li>\n<\/ol>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u7528\u4e8e\u5c06\u672c\u5730\u4ee3\u7801\u5e93\u4e2d\u7684\u4fee\u6539\u540c\u6b65\u5230 GitLab \u7684\u670d\u52a1\u5668\u4e0a\uff0c\u5176\u4e2d origin \u662f\u8fdc\u7a0b\u4ed3\u5e93\u7684\u540d\u79f0\uff0cmaster \u662f\u9ed8\u8ba4\u7684\u4e3b\u5206\u652f\u3002<\/p>\n<ol>\n<li>git pull origin master<\/li>\n<\/ol>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u7528\u4e8e\u5c06 GitLab \u4ed3\u5e93\u4e2d\u7684\u4ee3\u7801\u66f4\u65b0\u5230\u672c\u5730\u8ba1\u7b97\u673a\u4e0a\uff0c\u540c\u6837\u7684\uff0c\u5176\u4e2d origin \u662f\u8fdc\u7a0b\u4ed3\u5e93\u7684\u540d\u79f0\uff0cmaster \u662f\u9ed8\u8ba4\u7684\u4e3b\u5206\u652f\u3002<\/p>\n<ol>\n<li>git checkout -b new_branch_name<\/li>\n<\/ol>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u7528\u4e8e\u5728 GitLab \u4ed3\u5e93\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5206\u652f\u5e76\u4e14\u5207\u6362\u5230\u8fd9\u4e2a\u5206\u652f\u4e0a\u3002new_branch_name \u662f\u65b0\u5206\u652f\u7684\u540d\u79f0\u3002<\/p>\n<ol>\n<li>git merge branch_name<\/li>\n<\/ol>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u7528\u4e8e\u5c06\u4e00\u4e2a\u5206\u652f\u7684\u4fee\u6539\u5408\u5e76\u5230\u5f53\u524d\u5206\u652f\u4e2d\u3002branch_name \u662f\u8981\u5408\u5e76\u7684\u5206\u652f\u540d\u79f0\u3002<\/p>\n<ol>\n<li>git reset &#8211;hard HEAD<\/li>\n<\/ol>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u7528\u4e8e\u56de\u6eda\u672c\u6b21\u63d0\u4ea4\uff0c\u5c06\u672c\u6b21\u63d0\u4ea4\u4fee\u6539\u7684\u4ee3\u7801\u90fd\u64a4\u9500\u3002\u8fd9\u4e2a\u547d\u4ee4\u9700\u8981\u614e\u7528\uff0c\u56e0\u4e3a\u5b83\u4f1a\u5b8c\u5168\u5220\u9664\u4e0a\u6b21\u63d0\u4ea4\u7684\u4fee\u6539\u3002<\/p>\n<p>\u8fd9\u4e9b\u662f\u5e38\u7528\u7684 GitLab \u547d\u4ee4\uff0c\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u66f4\u597d\u5730\u7ba1\u7406\u4ee3\u7801\u5e93\u3002GitLab \u7684\u4f7f\u7528\u65b9\u6cd5\u6bd4\u8f83\u7c7b\u4f3c\u4e8e Github \u548c Bitbucket\uff0c\u4f46\u5b83\u63d0\u4f9b\u4e86\u66f4\u5f3a\u5927\u7684\u4ee3\u7801\u7ba1\u7406\u548c\u56e2\u961f\u534f\u4f5c\u529f\u80fd\uff0c\u662f\u4e00\u4e2a\u975e\u5e38\u4f18\u79c0\u7684\u4ee3\u7801\u7ba1\u7406\u5de5\u5177\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u3010\u6574\u7406\u5206\u4eab\u3011\u4e00\u4e9b\u5e38\u7528\u7684 GitLab \u547d\u4ee4\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>gitlab \u547d\u4ee4\u662f\u5728 git \u4e2d\u4f7f\u7528\u7684\uff0c\u5b83\u662f\u4e00\u4e2a\u57fa\u4e8e git \u4ee3\u7801\u7ba1\u7406\u7cfb\u7edf\u7684 web \u5e94\u7528\u7a0b\u5e8f\uff0c\u63d0\u4f9b\u6e90\u4ee3\u7801\u7ba1\u7406\u3001\u9879\u76ee\u534f\u4f5c\u3001\u6301\u7eed\u96c6\u6210\u548c\u90e8\u7f72\u7b49\u529f\u80fd\u3002\u5b83\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u6765\u7ba1\u7406\u5927\u578b\u56e2\u961f\u7684\u4ee3\u7801\u5e93\u3002 GitLab \u7684\u4f7f\u7528\u65b9\u6cd5\u5f88\u7b80\u5355\uff0c\u53ef\u4ee5\u901a\u8fc7 Git \u547d\u4ee4\u884c\u6216\u8005 GitLab \u7684\u56fe\u5f62\u5316\u754c\u9762\u6765\u8fdb\u884c\u64cd\u4f5c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684 GitLab \u547d\u4ee4: git clone git@gitlab.com:your_username\/your_project.git \u8fd9\u4e2a\u547d\u4ee4\u7528\u4e8e\u5c06\u4e00\u4e2a GitLab \u4e0a\u7684\u9879\u76ee\u590d\u5236\u5230\u672c\u5730\u8ba1\u7b97\u673a\u4e0a\u3002\u5176\u4e2d git@gitlab.com:your_username\/your_project.git \u662f\u4f60\u9879\u76ee\u7684\u5730\u5740\u3002 git add . \u8fd9\u4e2a\u547d\u4ee4\u7528\u4e8e\u5c06\u672c\u5730\u4fee\u6539\u7684\u4ee3\u7801\u6dfb\u52a0\u5230 GitLab \u7684\u7248\u672c\u5e93\u4e2d\u3002&#8221;.&#8221; \u7684\u610f\u601d\u662f\u5c06\u5f53\u524d\u76ee\u5f55\u4e0b\u6240\u6709\u4fee\u6539\u7684\u6587\u4ef6\u90fd\u6dfb\u52a0\u5230\u7248\u672c\u5e93\u4e2d\u3002 git commit -m &#8220;commit message&#8221; \u8fd9\u4e2a\u547d\u4ee4\u7528\u4e8e\u5c06\u6dfb\u52a0\u5230 GitLab \u7248\u672c\u5e93\u4e2d\u7684\u4ee3\u7801\u63d0\u4ea4\uff0c\u5e76\u4e14\u6dfb\u52a0 commit message \u8bf4\u660e\u672c\u6b21\u63d0\u4ea4\u505a\u4e86\u4ec0\u4e48\u4fee\u6539\u3002 git push origin master \u8fd9\u4e2a\u547d\u4ee4\u7528\u4e8e\u5c06\u672c\u5730\u4ee3\u7801\u5e93\u4e2d\u7684\u4fee\u6539\u540c\u6b65\u5230 GitLab \u7684\u670d\u52a1\u5668\u4e0a\uff0c\u5176\u4e2d origin \u662f\u8fdc\u7a0b\u4ed3\u5e93\u7684\u540d\u79f0\uff0cmaster \u662f\u9ed8\u8ba4\u7684\u4e3b\u5206\u652f\u3002 git pull origin [&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-19557","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19557","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=19557"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19557\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}