{"id":8205,"date":"2024-06-18T14:01:01","date_gmt":"2024-06-18T06:01:01","guid":{"rendered":""},"modified":"2024-06-18T14:01:01","modified_gmt":"2024-06-18T06:01:01","slug":"git\u600e\u4e48\u628a\u672c\u5730\u6587\u4ef6\u63d0\u4ea4\u5230\u8fdc\u7a0b\u4ed3\u5e93_git\u63d0\u4ea4\u4ee3\u7801\u8986\u76d6\u522b\u4eba\u7684\u4ee3\u7801","status":"publish","type":"post","link":"https:\/\/mushiming.com\/8205.html","title":{"rendered":"git\u600e\u4e48\u628a\u672c\u5730\u6587\u4ef6\u63d0\u4ea4\u5230\u8fdc\u7a0b\u4ed3\u5e93_git\u63d0\u4ea4\u4ee3\u7801\u8986\u76d6\u522b\u4eba\u7684\u4ee3\u7801"},"content":{"rendered":"

\n <\/path> \n<\/svg> <\/p>\n

\u9700\u6c42\uff1a\u73b0\u5728\u8981\u628a\u8fdc\u7a0b\u4ed3\u5e93originA\u4e2d\u7684dev\u5206\u652f\u4ee3\u7801\u540c\u6b65\u5230originB\u4e2d\u7684dev\u5206\u652f\uff01<\/p>\n

\u7b2c\u4e00\u6b65\uff1a\u914d\u7f6e\u597d\u4e24\u4e2a\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740 originA \u548c originB
\u8fd9\u91cc\u6709\u4e24\u79cd\u65b9\u6cd5
\u65b9\u6cd51 \uff1a
\u5728\u672c\u5730\u9879\u76ee\u5305\u5904\u53f3\u51fb\u6253\u5f00Git Base Here\u7a97\u53e3\u4e2d\u6572\u547d\u4ee4\uff1a
\"git\u600e\u4e48\u628a\u672c\u5730\u6587\u4ef6\u63d0\u4ea4\u5230\u8fdc\u7a0b\u4ed3\u5e93_git\u63d0\u4ea4\u4ee3\u7801\u8986\u76d6\u522b\u4eba\u7684\u4ee3\u7801<\/p>\n

git remote -v \/\/\u53ef\u4ee5\u67e5\u770b\u5f53\u524d\u7684\u8fdc\u7a0b\u4ed3\u5e93url\u4fe1\u606f
git remote rm origin \/\/\u53ef\u4ee5\u5220\u9664\u8fd9\u4e2a\u8fdc\u7a0b\u4ed3\u5e93\u8fde\u63a5\u5173\u7cfb
git remote add origin http:\/\/\u8fdc\u7a0bgit\u4ed3\u5e93\u5730\u5740 \/\/\u6dfb\u52a0\u8fdc\u7a0b\u4ed3\u5e93
\u65b9\u6cd52\uff1a
\u5728idea\u4e2d\u64cd\u4f5c\uff1a
\u4e0a\u65b9\u5de5\u5177\u680fVCS\u2013Git\u2013Remotes\u2013\u70b9\u51fb+\u53f7 \u5373\u53ef\u6dfb\u52a0\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740
\"git\u600e\u4e48\u628a\u672c\u5730\u6587\u4ef6\u63d0\u4ea4\u5230\u8fdc\u7a0b\u4ed3\u5e93_git\u63d0\u4ea4\u4ee3\u7801\u8986\u76d6\u522b\u4eba\u7684\u4ee3\u7801
\u7b2c\u4e8c\u6b65\uff1a\u5907\u4efd\u6e90\u4ed3\u5e93originA\u4e2d\u7684dev\u5206\u652f\u4e3adev-bak
(\u539f\u5219\u4e0a\u662f\u53ef\u4ee5\u76f4\u63a5\u64cd\u4f5cdev\u5206\u652f\u7684\uff0c\u4f46\u662f\u6211\u6015\u628adev\u5e72\u5d29\u4e86\u4f1a\u6328\u6253\uff0c\u6240\u4ee5\u6211\u5728\u5907\u4efd\u5206\u652f\u4e0a\u5e72\uff0c\u4f60\u5c41\u80a1\u5927\u4f60\u53ef\u4ee5\u4e0d\u5907\u4efd\uff0c\u6ca1\u4e8b\u513f~~ )<\/p>\n

\u53bbgitlab\u4e0a\u65b0\u5efa\u4e2a\u5206\u652f\u6216\u8005\u6572\u547d\u4ee4\u90fd\u53ef\u4ee5\uff0c\u547d\u4ee4\u4e5f\u7ed9\u4f60\u8d34\u51fa\u6765\uff1a
\u67e5\u770b\u5206\u652f\uff1agit branch
\u521b\u5efa\u5206\u652f\uff1agit branch
\u5207\u6362\u5206\u652f\uff1agit checkout
\u521b\u5efa+\u5207\u6362\u5206\u652f\uff1agit checkout -b
\u5408\u5e76\u67d0\u5206\u652f\u5230\u5f53\u524d\u5206\u652f\uff1agit merge <\u5206\u652f\u540d> \/\/\u5408\u5e76\u5206\u652f\u65f6\uff0c\u52a0\u4e0a\u2013no-ff\u53c2\u6570\u5c31\u53ef\u4ee5\u7528\u666e\u901a\u6a21\u5f0f\u5408\u5e76\uff0c\u5408\u5e76\u540e\u7684\u5386\u53f2\u6709\u5206\u652f\uff0c\u80fd \u770b\u51fa\u6765\u66fe\u7ecf\u505a\u8fc7\u5408\u5e76\uff0c\u800c\u4e0d\u52a0\u2013no-ff\u5408\u5e76\u5c31\u770b\u4e0d\u51fa\u6765\u66fe\u7ecf\u505a\u8fc7\u5408\u5e76\u3002\u4f8bgit merge --no-ff -m \u201c\u8be6\u7ec6\u89e3\u91ca\u201d \u5206\u652f
\u5220\u9664\u5206\u652f\uff1agit branch -d
\u67e5\u770b\u5206\u652f\u5408\u5e76\u56fe: git log --graph<\/p>\n

\u7b2c\u4e09\u6b65\uff1a\u5c06\u6e90\u4ed3\u5e93originA\u4e2d\u7684dev-bak\u5206\u652f\u63a8\u9001\u5230\u76ee\u6807\u4ed3\u5e93originB\u4e2d\u53bb
git push originB dev-bak<\/strong>
(\u6ce8\u610f\uff0c\u8fd9\u4e2a\u547d\u4ee4\u662f\u5728originA\u4e2d\u6572\u7684\u54e6\uff0c\u56e0\u4e3a\u7b2c\u4e8c\u6b65\u64cd\u4f5c\u5b8c\u4e86\u4e4b\u540e \u4f60\u5c31\u5e94\u8be5\u662f\u5728origin\u4ed3\u5e93\u4e2d\u7684dev-bak\u5206\u652f\u91cc\u7684)
\u8fd9\u91cc\u53ef\u80fd\u4f1a\u62a5\u9519\u8bf4\u4f60\u5f53\u524d\u5206\u652f\u6ca1\u6709\u4e0a\u6e38\u5206\u652f\uff0c\u7136\u540e\u8fd8\u4f1a\u7ed9\u4f60\u63d0\u793a\u4e86\u4e00\u4e2a\u547d\u4ee4\uff0c\u76f4\u63a5\u7528\u63d0\u793a\u51fa\u6765\u7684\u547d\u4ee4\u5c31\u597d
\"git\u600e\u4e48\u628a\u672c\u5730\u6587\u4ef6\u63d0\u4ea4\u5230\u8fdc\u7a0b\u4ed3\u5e93_git\u63d0\u4ea4\u4ee3\u7801\u8986\u76d6\u522b\u4eba\u7684\u4ee3\u7801
git push --set-upstream origin dev-bak<\/strong>
\"git\u600e\u4e48\u628a\u672c\u5730\u6587\u4ef6\u63d0\u4ea4\u5230\u8fdc\u7a0b\u4ed3\u5e93_git\u63d0\u4ea4\u4ee3\u7801\u8986\u76d6\u522b\u4eba\u7684\u4ee3\u7801
\u81f3\u6b64\uff0coriginA\u4ed3\u5e93\u4e2d\u7684dev-bak\u540c\u6b65\u5230\u4e86originB\u4ed3\u5e93\u4e2d\u53bb\u4e86\uff0c\u53ea\u4e0d\u8fc7\u5206\u652f\u540d\u79f0\u4e5f\u53ebdev-bak<\/p>\n

\u7b2c\u56db\u6b65\uff1a
\u5220\u9664originA\u4ed3\u5e93\u4e2d\u7684\u5907\u4efddev-bak\u5206\u652f;
\u4fee\u6539originB\u4ed3\u5e93\u4e2d\u7684dev-bak\u540d\u79f0\uff08\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u4fee\u6539\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"git\u600e\u4e48\u628a\u672c\u5730\u6587\u4ef6\u63d0\u4ea4\u5230\u8fdc\u7a0b\u4ed3\u5e93_git\u63d0\u4ea4\u4ee3\u7801\u8986\u76d6\u522b\u4eba\u7684\u4ee3\u7801\u9700\u6c42\uff1a\u73b0\u5728\u8981\u628a\u8fdc\u7a0b\u4ed3\u5e93originA\u4e2d\u7684dev\u5206\u652f\u4ee3\u7801\u540c\u6b65\u5230originB\u4e2d...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8205"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=8205"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8205\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=8205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=8205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=8205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}