{"id":721,"date":"2025-09-13T15:47:24","date_gmt":"2025-09-13T07:47:24","guid":{"rendered":"https:\/\/znl.pub\/?p=721"},"modified":"2025-09-13T15:47:24","modified_gmt":"2025-09-13T07:47:24","slug":"%e4%bb%8e%e5%85%b6%e4%bb%96-git-%e4%bb%93%e5%ba%93%e5%85%8b%e9%9a%86%e7%9a%84%e9%a1%b9%e7%9b%ae%e6%8f%90%e4%ba%a4%e5%88%b0%e8%87%aa%e5%b7%b1%e7%9a%84-git-%e4%bb%93%e5%ba%93","status":"publish","type":"post","link":"https:\/\/znl.pub\/?p=721","title":{"rendered":"\u4ece\u5176\u4ed6 Git \u4ed3\u5e93\u514b\u9686\u7684\u9879\u76ee\u63d0\u4ea4\u5230\u81ea\u5df1\u7684 Git \u4ed3\u5e93"},"content":{"rendered":"\n<p>\u5c06\u5f53\u524d\u4ece\u5176\u4ed6 Git \u4ed3\u5e93\u514b\u9686\u7684\u9879\u76ee\u63d0\u4ea4\u5230<strong>\u81ea\u5df1\u7684 Git \u4ed3\u5e93<\/strong>\uff0c\u4ee5\u4e0b\u662f\u5b8c\u6574\u6b65\u9aa4\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 1\uff1a\u68c0\u67e5\u5f53\u524d Git \u8fdc\u7a0b\u4ed3\u5e93<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code><code>git remote -v<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5982\u679c\u663e\u793a <code>origin<\/code> \u6307\u5411\u65e7\u4ed3\u5e93\uff08\u4f60\u514b\u9686\u7684\u6e90\uff09\uff0c\u800c <code>up<\/code> \u6307\u5411\u4e2a\u4eba\u4ed3\u5e93\uff0c\u53ef\u4ee5\u7ee7\u7eed\u64cd\u4f5c\u3002<\/li>\n\n\n\n<li>\u5982\u679c <code>up<\/code> \u4e0d\u5b58\u5728\u6216\u6307\u5411\u9519\u8bef\uff0c\u5148\u6dfb\u52a0\u516c\u53f8\u4ed3\u5e93\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>git remote add up https:\/\/gitlab.your.site\/xxxx\/frontend.git<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 2\uff1a\u786e\u4fdd\u672c\u5730\u4ee3\u7801\u5728 <code>feature\/vben<\/code> \u5206\u652f<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code><code><em># \u521b\u5efa\u5e76\u5207\u6362\u5230 feature\/vben \u5206\u652f\uff08\u5982\u679c\u4e0d\u5b58\u5728\uff09<\/em>\ngit checkout -b feature\/vben<\/code>\n# <code>git checkout -b<\/code> \u662f\u57fa\u4e8e\u5f53\u524d\u76ee\u5f55\u6587\u4ef6\u5185\u5bb9\u521b\u5efa\u65b0\u7684\u5206\u652f<code>\n\n<em># \u5982\u679c\u5df2\u5b58\u5728\uff0c\u76f4\u63a5\u5207\u6362<\/em>\ngit checkout feature\/vben<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 3\uff1a\u63d0\u4ea4\u4ee3\u7801\u5230\u672c\u5730\u4ed3\u5e93<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code><code><em># \u6dfb\u52a0\u6240\u6709\u66f4\u6539\uff08\u6216\u6307\u5b9a\u6587\u4ef6\uff09<\/em>\ngit add .\n\n<em># \u63d0\u4ea4\u66f4\u6539<\/em>\ngit commit -m \"feat: \u63d0\u4ea4\u4ee3\u7801\u5230\u516c\u53f8\u4ed3\u5e93\u7684 feature\/vben \u5206\u652f\"<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 4\uff1a\u63a8\u9001\u5230\u516c\u53f8\u4ed3\u5e93\u7684 <code>feature\/vben<\/code> \u5206\u652f<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code><code><em># \u9996\u6b21\u63a8\u9001\uff08\u5efa\u7acb\u8fdc\u7a0b\u5206\u652f\u5173\u8054\uff09<\/em>\ngit push -u up feature\/vben\n\n<em># \u540e\u7eed\u63a8\u9001\u53ea\u9700<\/em>\ngit push<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b65\u9aa4 5\uff1a\u5904\u7406\u53ef\u80fd\u7684\u51b2\u7a81<\/strong><\/h3>\n\n\n\n<p>\u5982\u679c\u8fdc\u7a0b <code>feature\/vben<\/code> \u5df2\u5b58\u5728\u4e14\u548c\u4f60\u7684\u4ee3\u7801\u6709\u51b2\u7a81\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code><em># \u5148\u62c9\u53d6\u8fdc\u7a0b\u6700\u65b0\u4ee3\u7801<\/em>\ngit pull up feature\/vben\n\n<em># \u89e3\u51b3\u51b2\u7a81\u540e\u91cd\u65b0\u63d0\u4ea4<\/em>\ngit add .\ngit commit -m \"fix: \u89e3\u51b3\u51b2\u7a81\"\ngit push<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u5173\u952e\u6ce8\u610f\u4e8b\u9879<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u6743\u9650\u95ee\u9898<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u786e\u4fdd\u4f60\u6709\u6743\u9650\u63a8\u9001\u5230\u4f60\u81ea\u5df1\u4ed3\u5e93\u7684 <code>feature\/vben<\/code> \u5206\u652f\uff08\u6700\u597d\u5206\u652f\u5728\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u4e0d\u5b58\u5728\uff0c\u5982\u679c\u5b58\u5728\u5c31\u6362\u4e00\u4e2a\u5206\u652f\u540d\u5427\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u6e05\u9664\u65e7\u4ed3\u5e93\u4fe1\u606f<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5982\u679c\u4e0d\u60f3\u4fdd\u7559\u539f\u514b\u9686\u4ed3\u5e93\u7684 <code>origin<\/code>\uff0c\u53ef\u4ee5\u5220\u9664\uff1a<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code><code>     git remote remove origin<\/code><\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>\u5f3a\u5236\u63a8\u9001\uff08\u8c28\u614e\uff01\uff09<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5982\u679c\u786e\u5b9a\u8981\u8986\u76d6\u8fdc\u7a0b\u5206\u652f\uff08\u5982\u4ee3\u7801\u91cd\u6784\uff09\uff0c\u53ef\u4f7f\u7528\uff1a<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code><code>     git push -f up feature\/vben<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u26a0\ufe0f \u8fd9\u4f1a\u8986\u76d6\u8fdc\u7a0b\u5386\u53f2\u8bb0\u5f55\uff0c\u4ec5\u9650\u4e2a\u4eba\u5206\u652f\u4f7f\u7528\uff01<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u5b8c\u6574\u6d41\u7a0b\u793a\u4f8b<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Bash<code><em># 1. \u6dfb\u52a0\u4f60\u7684\u4ed3\u5e93\uff08\u5982\u679c\u672a\u6dfb\u52a0\uff09<\/em><br>git remote add up https:\/\/gitlab.madbull.site\/mygroup\/mailtrace\/frontend.git<br><br><em># 2. \u521b\u5efa\u5e76\u5207\u6362\u5230\u76ee\u6807\u5206\u652f<\/em><br>git checkout -b feature\/vben<br><br><em># 3. \u63d0\u4ea4\u4ee3\u7801<\/em><br>git add .<br>git commit -m \"feat: \u521d\u59cb\u5316\u9879\u76ee\u4ee3\u7801\"<br><br><em># 4. \u63a8\u9001\u5230\u4f60\u81ea\u5df1\u7684\u4ed3\u5e93<\/em><br>git push -u up feature\/vben<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u603b\u7ed3<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u6b65\u9aa4<\/th><th>\u547d\u4ee4\/\u64cd\u4f5c<\/th><th>\u8bf4\u660e<\/th><\/tr><\/thead><tbody><tr><td><strong>1. \u68c0\u67e5\u8fdc\u7a0b\u4ed3\u5e93<\/strong><\/td><td><code>git remote -v<\/code><\/td><td>\u786e\u8ba4 <code>up<\/code> \u6307\u5411\u81ea\u5df1\u4ed3\u5e93<\/td><\/tr><tr><td><strong>2. \u5207\u6362\u5206\u652f<\/strong><\/td><td><code>git checkout -b feature\/vben<\/code><\/td><td>\u786e\u4fdd\u5728\u6b63\u786e\u7684\u5206\u652f\u5de5\u4f5c<\/td><\/tr><tr><td><strong>3. \u63d0\u4ea4\u4ee3\u7801<\/strong><\/td><td><code>git add . &amp;&amp; git commit -m \"...\"<\/code><\/td><td>\u672c\u5730\u4fdd\u5b58\u66f4\u6539<\/td><\/tr><tr><td><strong>4. \u63a8\u9001\u5230\u8fdc\u7a0b<\/strong><\/td><td><code>git push -u up feature\/vben<\/code><\/td><td>\u9996\u6b21\u63a8\u9001\u9700 <code>-u<\/code> \u5efa\u7acb\u5173\u8054<\/td><\/tr><tr><td><strong>5. \u5904\u7406\u51b2\u7a81<\/strong><\/td><td><code>git pull up feature\/vben<\/code><\/td><td>\u5408\u5e76\u8fdc\u7a0b\u53d8\u66f4\uff08\u5982\u6709\u51b2\u7a81\uff09<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u6309\u6b64\u6d41\u7a0b\u64cd\u4f5c\uff0c\u5373\u53ef\u5c06\u4ee3\u7801\u5b89\u5168\u8fc1\u79fb\u5230\u81ea\u5df1\u4ed3\u5e93\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c06\u5f53\u524d\u4ece\u5176\u4ed6 Git \u4ed3\u5e93\u514b\u9686\u7684\u9879\u76ee\u63d0\u4ea4\u5230\u81ea\u5df1\u7684 Git \u4ed3\u5e93\uff0c\u4ee5\u4e0b\u662f\u5b8c\u6574\u6b65\u9aa4\uff1a \u6b65\u9aa4 1\uff1a\u68c0\u67e5\u5f53\u524d Git &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-721","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/posts\/721","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/znl.pub\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=721"}],"version-history":[{"count":1,"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/posts\/721\/revisions"}],"predecessor-version":[{"id":722,"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/posts\/721\/revisions\/722"}],"wp:attachment":[{"href":"https:\/\/znl.pub\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=721"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/znl.pub\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=721"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/znl.pub\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}