{"id":1191,"date":"2020-08-01T18:57:54","date_gmt":"2020-08-01T10:57:54","guid":{"rendered":"https:\/\/www.siediyer.cn\/?p=1191"},"modified":"2020-08-01T18:58:07","modified_gmt":"2020-08-01T10:58:07","slug":"git%e6%9c%ac%e5%9c%b0%e5%88%86%e6%94%af%e5%92%8c%e8%bf%9c%e7%a8%8b%e5%88%86%e6%94%af%e5%85%b3%e8%81%94","status":"publish","type":"post","link":"https:\/\/www.siediyer.cn\/?p=1191","title":{"rendered":"Git\u672c\u5730\u5206\u652f\u548c\u8fdc\u7a0b\u5206\u652f\u5173\u8054"},"content":{"rendered":"<p>1.\u521b\u5efa\u5206\u652f<\/p>\n<pre class=\"lang:default decode:true \">git branch develop<\/pre>\n<p>2.\u67e5\u770b\u672c\u5730\u5206\u652f\uff1a<\/p>\n<pre class=\"lang:default decode:true \">git branch<\/pre>\n<p>\u6ce8:\u540d\u79f0\u524d\u9762\u52a0* \u53f7\u7684\u662f\u5f53\u524d\u7684\u5206\u652f<\/p>\n<p>3.\u67e5\u770b\u8fdc\u7a0b\u5206\u652f\uff1a<\/p>\n<p>\u52a0\u4e0a-a\u53c2\u6570\u53ef\u4ee5\u67e5\u770b\u8fdc\u7a0b\u5206\u652f\uff0c\u8fdc\u7a0b\u5206\u652f\u4f1a\u7528\u7ea2\u8272\u8868\u793a\u51fa\u6765\uff08\u5982\u679c\u4f60\u5f00\u4e86\u989c\u8272\u652f\u6301\u7684\u8bdd\uff09<\/p>\n<pre class=\"lang:default decode:true \">git branch -a<\/pre>\n<p>4.\u5207\u6362\u5206\u652f<\/p>\n<pre class=\"lang:default decode:true \">git checkout branch_name<\/pre>\n<p>5.\u5220\u9664\u672c\u5730\u5206\u652f<\/p>\n<pre class=\"lang:default decode:true \">git branch -d branch_name<\/pre>\n<p>6.\u5220\u9664\u8fdc\u7a0b\u5206\u652f<\/p>\n<pre class=\"lang:default decode:true \">git branch -r -d origin\/branch-name  \r\ngit push origin :branch-name<\/pre>\n<p>7.\u5982\u679c\u8fdc\u7a0b\u65b0\u5efa\u4e86\u4e00\u4e2a\u5206\u652f\uff0c\u672c\u5730\u6ca1\u6709\u8be5\u5206\u652f\u3002<\/p>\n<p>\u53ef\u4ee5\u5229\u7528\u00a0git checkout\u00a0&#8211;track\u00a0origin\/branch_name\u00a0\uff0c\u8fd9\u65f6\u672c\u5730\u4f1a\u65b0\u5efa\u4e00\u4e2a\u5206\u652f\u540d\u53eb\u00a0branch_name\u00a0\uff0c\u4f1a\u81ea\u52a8\u8ddf\u8e2a\u8fdc\u7a0b\u7684\u540c\u540d\u5206\u652f\u00a0branch_name\u3002<\/p>\n<pre class=\"lang:default decode:true \">git checkout --track origin\/branch_name<\/pre>\n<p>8.\u5982\u679c\u672c\u5730\u65b0\u5efa\u4e86\u4e00\u4e2a\u5206\u652f branch_name\uff0c\u4f46\u662f\u5728\u8fdc\u7a0b\u6ca1\u6709\u3002<\/p>\n<p>\u8fd9\u65f6\u5019\u00a0push \u548c pull\u00a0\u6307\u4ee4\u5c31\u65e0\u6cd5\u786e\u5b9a\u8be5\u8ddf\u8e2a\u8c01\uff0c\u4e00\u822c\u6765\u8bf4\u6211\u4eec\u90fd\u4f1a\u4f7f\u5176\u8ddf\u8e2a\u8fdc\u7a0b\u540c\u540d\u5206\u652f\uff0c\u6240\u4ee5\u53ef\u4ee5\u5229\u7528\u00a0git push\u00a0&#8211;set-upstream origin\u00a0branch_name\u00a0\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u81ea\u52a8\u5728\u8fdc\u7a0b\u521b\u5efa\u4e00\u4e2a\u00a0branch_name\u00a0\u5206\u652f\uff0c\u7136\u540e\u672c\u5730\u5206\u652f\u4f1a\u00a0track\u00a0\u8be5\u5206\u652f\u3002\u540e\u9762\u518d\u5bf9\u8be5\u5206\u652f\u4f7f\u7528 push \u548c pull \u5c31\u81ea\u52a8\u540c\u6b65\u3002<\/p>\n<pre class=\"lang:default decode:true \">git push --set-upstream origin branch_name<\/pre>\n<p>9.\u5408\u5e76\u5206\u652f\u5230master\u4e0a<\/p>\n<p>\u9996\u5148\u5207\u6362\u5230master\u5206\u652f\u4e0a<\/p>\n<pre class=\"lang:default decode:true \">git  checkout master<\/pre>\n<p>\u5982\u679c\u662f\u591a\u4eba\u5f00\u53d1\u7684\u8bdd \u9700\u8981\u628a\u8fdc\u7a0bmaster\u4e0a\u7684\u4ee3\u7801pull\u4e0b\u6765<\/p>\n<pre class=\"lang:default decode:true \">git pull origin master<\/pre>\n<p>\u7136\u540e\u6211\u4eec\u628adev\u5206\u652f\u7684\u4ee3\u7801\u5408\u5e76\u5230master\u4e0a<\/p>\n<pre class=\"lang:default decode:true \">git  merge dev<\/pre>\n<p>\u7136\u540e\u67e5\u770b\u72b6\u6001<\/p>\n<pre class=\"lang:default decode:true \">git status<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u521b\u5efa\u5206\u652f git branch develop 2.\u67e5\u770b\u672c\u5730\u5206\u652f\uff1a git branch \u6ce8:\u540d\u79f0\u524d\u9762\u52a0* [&hellip;]<\/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-1191","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/1191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1191"}],"version-history":[{"count":2,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/1191\/revisions"}],"predecessor-version":[{"id":1193,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/1191\/revisions\/1193"}],"wp:attachment":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}