{"id":16037,"date":"2024-07-19T14:12:55","date_gmt":"2024-07-19T06:12:55","guid":{"rendered":"https:\/\/92it.top\/?p=16037"},"modified":"2024-07-19T14:13:16","modified_gmt":"2024-07-19T06:13:16","slug":"git-push%e7%9a%84%e6%97%b6%e5%80%99%e5%8f%af%e4%bb%a5%e5%8f%aapush%e9%83%a8%e5%88%86%e4%bb%a3%e7%a0%81%e5%90%97%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=16037","title":{"rendered":"git push\u7684\u65f6\u5019\u53ef\u4ee5\u53eapush\u90e8\u5206\u4ee3\u7801\u5417\uff1f"},"content":{"rendered":"\n<p><strong>\u95ee\u9898<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>commit\u5230\u672c\u5730\u4ed3\u5e93\u7684\u65f6\u5019\u53ef\u80fd\u5df2\u7ecf\u63d0\u4ea4\u8fc7\u597d\u51e0\u7248\u4e86\uff0c\u4f46\u662f\u5f80\u670d\u52a1\u5668push\u7684\u65f6\u5019\u4e0d\u9700\u8981\u5168\u90e8\u90fdpush\uff0cgit\u652f\u6301\u4e0d\u652f\u6301\u53eapush\u90e8\u5206\u4ee3\u7801\uff0c\u800c\u4e0d\u662f\u6211\u8ddd\u79bb\u4e0a\u6b21\u7248\u672c\u4e4b\u540e\u4fee\u6539\u7684\u6240\u6709\u5185\u5bb9\u3002<\/p>\n\n\n\n<p><strong>push \u7684\u672c\u8d28<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><code>push<\/code> \u6307\u4ee4\u505a\u7684\u4e8b\u662f\u628a\u4f60\u7684\u672c\u5730\u63d0\u4ea4\u4e0a\u4f20\u5230\u4e2d\u592e\u4ed3\u5e93\u53bb\uff0c\u7528\u672c\u5730\u7684\u5185\u5bb9\u6765\u8986\u76d6\u6389\u8fdc\u7aef\u7684\u5185\u5bb9\u3002\u8fd9\u4e2a\u8bf4\u6cd5\u5176\u5b9e\u662f\u4e0d\u591f\u51c6\u786e\u7684\uff0c\u4f46 Git \u7684\u77e5\u8bc6\u7cfb\u7edf\u6bd4\u8f83\u5e9e\u5927\uff0c\u5728\u4f60\u5bf9 Git \u4e86\u89e3\u6bd4\u8f83\u5c11\u7684\u65f6\u5019\uff0c\u7528\u300c\u4e0a\u4f20\u672c\u5730\u63d0\u4ea4\u300d\u6765\u89e3\u91ca\u4f1a\u6bd4\u8f83\u597d\u7406\u89e3\uff1b\u800c\u5728\u4f60\u77e5\u9053\u4e86 <code>branch<\/code>\uff0c\u5e76\u4e14\u660e\u767d\u4e86 <code>branch<\/code> \u7684\u5177\u4f53\u542b\u4e49\u4ee5\u540e\uff0c\u6211\u5c31\u53ef\u4ee5\u544a\u8bc9\u4f60 <code>push<\/code> \u5230\u5e95\u662f\u4ec0\u4e48\u4e86\u3002<\/p>\n\n\n\n<p><strong>push\uff1a\u628a branch \u4e0a\u4f20\u5230\u8fdc\u7aef\u4ed3\u5e93<\/strong><\/p>\n\n\n\n<p>\u5b9e\u8d28\u4e0a\uff0c<code>push<\/code> \u505a\u7684\u4e8b\u662f\uff1a\u628a\u5f53\u524d <code>branch<\/code> \u7684\u4f4d\u7f6e\uff08\u5373\u5b83\u6307\u5411\u54ea\u4e2a <code>commit<\/code>\uff09\u4e0a\u4f20\u5230\u8fdc\u7aef\u4ed3\u5e93\uff0c\u5e76\u628a\u5b83\u7684\u8def\u5f84\u4e0a\u7684 <code>commit<\/code>s \u4e00\u5e76\u4e0a\u4f20\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff0c\u6211\u73b0\u5728\u7684\u672c\u5730\u4ed3\u5e93\u6709\u4e00\u4e2a <code>master<\/code> \uff0c\u5b83\u8d85\u524d\u4e86\u8fdc\u7a0b\u4ed3\u5e93\u4e24\u4e2a\u63d0\u4ea4\uff1b\u53e6\u5916\u8fd8\u6709\u4e00\u4e2a\u65b0\u5efa\u7684 <code>branch<\/code> \u53eb <code>feature1<\/code>\uff0c\u8fdc\u7a0b\u4ed3\u5e93\u8fd8\u6ca1\u6709\u8bb0\u8f7d\u8fc7\u5b83\u3002\u5177\u4f53\u5927\u6982\u50cf\u8fd9\u6837\uff1a<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"1024\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-216-710x1024.png\" alt=\"\" class=\"wp-image-16038\" style=\"width:340px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-216-710x1024.png 710w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-216-208x300.png 208w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-216-768x1108.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-216-830x1198.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-216-230x332.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-216-350x505.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-216-480x693.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-216.png 894w\" sizes=\"(max-width: 710px) 100vw, 710px\" \/><\/figure><\/div>\n\n\n<p>\u8fd9\u65f6\u6211\u6267\u884c <code>git push<\/code>\uff0c\u5c31\u4f1a\u628a <code>master<\/code> \u7684\u6700\u65b0\u4f4d\u7f6e\u66f4\u65b0\u5230\u8fdc\u7aef\uff0c\u5e76\u4e14\u628a\u5b83\u7684\u8def\u5f84\u4e0a\u7684 <code>5<\/code> <code>6<\/code> \u4e24\u4e2a <code>commit<\/code>s \u4e0a\u4f20\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git push<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"604\" height=\"816\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/v2-39fdec0dc1347410e61d42d0f7732304_720w.webp\" alt=\"\" class=\"wp-image-16039\" style=\"width:400px;height:auto\"\/><\/figure><\/div>\n\n\n<p>\u800c\u5982\u679c\u8fd9\u65f6\u5019\u6211\u518d\u5207\u5230 <code>feature1<\/code> \u53bb\u540e\u518d\u6267\u884c\u4e00\u6b21 <code>push<\/code>\uff0c\u5c31\u4f1a\u628a <code>feature1<\/code> \u4ee5\u53ca\u5b83\u7684 <code>commit<\/code> <code>4<\/code> \u4e0a\u4f20\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git checkout feature1\ngit push origin feature1<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">\u8fd9\u91cc\u7684 git push \u548c\u4e4b\u524d\u6709\u70b9\u4e0d\u540c\uff1a\u591a\u4e86 origin feature1 \u8fd9\u4e24\u4e2a\u53c2\u6570\u3002\u5176\u4e2d origin \u662f\u8fdc\u7a0b\u4ed3\u5e93\u7684\u522b\u540d\uff0c\u662f\u4f60\u5728 git clone \u7684\u65f6\u5019 Git \u81ea\u52a8\u5e2e\u4f60\u8d77\u7684\uff1bfeature1 \u662f\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u76ee\u6807 branch \u7684\u540d\u5b57\u3002\u8fd9\u4e24\u4e2a\u53c2\u6570\u5408\u8d77\u6765\u6307\u5b9a\u4e86\u4f60\u8981 push \u5230\u7684\u76ee\u6807\u4ed3\u5e93\u548c\u76ee\u6807\u5206\u652f\uff0c\u610f\u601d\u662f\u300c\u6211\u8981 push \u5230 origin \u8fd9\u4e2a\u4ed3\u5e93\u7684 feature1 \u5206\u652f\u300d\u3002<br>\u5728 Git \u4e2d\uff082.0 \u53ca\u5b83\u4e4b\u540e\u7684\u7248\u672c\uff09\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f60\u7528\u4e0d\u52a0\u53c2\u6570\u7684 git push \u53ea\u80fd\u4e0a\u4f20\u90a3\u4e9b\u4e4b\u524d\u4ece\u8fdc\u7aef clone \u4e0b\u6765\u6216\u8005 pull \u4e0b\u6765\u7684\u5206\u652f\uff0c\u800c\u5982\u679c\u9700\u8981 push \u4f60\u672c\u5730\u7684\u81ea\u5df1\u521b\u5efa\u7684\u5206\u652f\uff0c\u5219\u9700\u8981\u624b\u52a8\u6307\u5b9a\u76ee\u6807\u4ed3\u5e93\u548c\u76ee\u6807\u5206\u652f\uff08\u5e76\u4e14\u76ee\u6807\u5206\u652f\u7684\u540d\u79f0\u5fc5\u987b\u548c\u672c\u5730\u5206\u652f\u5b8c\u5168\u76f8\u540c\uff09\uff0c\u5c31\u50cf\u4e0a\u9762\u8fd9\u6837\u3002<br>\u4f60\u53ef\u4ee5\u901a\u8fc7 git config \u6307\u4ee4\u6765\u8bbe\u7f6e push.default \u7684\u503c\u6765\u6539\u53d8 push \u7684\u884c\u4e3a\u903b\u8f91\uff0c\u4f8b\u5982\u53ef\u4ee5\u8bbe\u7f6e\u4e3a\u300c\u6240\u6709\u5206\u652f\u90fd\u53ef\u4ee5\u7528 git push \u6765\u76f4\u63a5 push\uff0c\u76ee\u6807\u81ea\u52a8\u6307\u5411 origin \u4ed3\u5e93\u7684\u540c\u540d\u5206\u652f\u300d\uff08\u5bf9\u5e94\u7684 push.default \u503c\uff1acurrent\uff09\uff0c\u6216\u8005\u522b\u7684\u4ec0\u4e48\u884c\u4e3a\u903b\u8f91\uff0c\u4f60\u751a\u81f3\u53ef\u4ee5\u8bbe\u7f6e\u4e3a\u6bcf\u6b21\u6267\u884c git push \u65f6\u5c31\u81ea\u52a8\u628a\u6240\u6709\u672c\u5730\u5206\u652f\u5168\u90e8\u540c\u6b65\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff08\u867d\u7136\u8fd9\u53ef\u80fd\u6709\u70b9\u8017\u65f6\u548c\u5371\u9669\uff09\u3002\u5982\u679c\u5e0c\u671b\u8be6\u7ec6\u4e86\u89e3\uff0c\u4f60\u53ef\u4ee5\u5230\u8fd9\u91cc\u770b\u770b\u3002<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"681\" height=\"1024\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-218-681x1024.png\" alt=\"\" class=\"wp-image-16041\" style=\"width:374px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-218-681x1024.png 681w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-218-199x300.png 199w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-218-768x1156.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-218-830x1249.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-218-230x346.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-218-350x527.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-218-480x722.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2024\/07\/image-218.png 844w\" sizes=\"(max-width: 681px) 100vw, 681px\" \/><\/figure><\/div>\n\n\n<p>\u7ec6\u5fc3\u7684\u4eba\u53ef\u80fd\u4f1a\u53d1\u73b0\uff0c\u5728 <code>feature1<\/code> \u88ab <code>push<\/code> \u65f6\uff0c\u8fdc\u7a0b\u4ed3\u5e93\u7684 <code>HEAD<\/code> \u5e76\u6ca1\u6709\u548c\u672c\u5730\u4ed3\u5e93\u7684 <code>HEAD<\/code> \u4e00\u6837\u6307\u5411 <code>feature1<\/code>\u3002\u8fd9\u662f\u56e0\u4e3a\uff0c<code>push<\/code> \u7684\u65f6\u5019\u53ea\u4f1a\u4e0a\u4f20\u5f53\u524d\u7684 <code>branch<\/code> \u7684\u6307\u5411\uff0c\u5e76\u4e0d\u4f1a\u628a\u672c\u5730\u7684 <code>HEAD<\/code> \u7684\u6307\u5411\u4e5f\u4e00\u8d77\u4e0a\u4f20\u5230\u8fdc\u7a0b\u4ed3\u5e93\u3002\u4e8b\u5b9e\u4e0a\uff0c\u8fdc\u7a0b\u4ed3\u5e93\u7684 <code>HEAD<\/code> \u662f\u6c38\u8fdc\u6307\u5411\u5b83\u7684\u9ed8\u8ba4\u5206\u652f\uff08\u5373 master\uff0c\u5982\u679c\u4e0d\u4fee\u6539\u5b83\u7684\u540d\u79f0\u7684\u8bdd\uff09\uff0c\u5e76\u4f1a\u968f\u7740\u9ed8\u8ba4\u5206\u652f\u7684\u79fb\u52a8\u800c\u79fb\u52a8\u7684\u3002<\/p>\n\n\n\n<p><strong>\u5c0f\u7ed3<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u8fd9\u4e00\u8282\u4ecb\u7ecd\u4e86 <code>push<\/code> \u8fd9\u4e2a\u6307\u4ee4\u7684\u672c\u8d28\u3002\u603b\u7ed3\u4e00\u4e0b\u5173\u952e\u70b9\uff1a<\/p>\n\n\n\n<ol>\n<li><code>push<\/code> \u662f\u628a\u5f53\u524d\u7684\u5206\u652f\u4e0a\u4f20\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u5e76\u628a\u8fd9\u4e2a <code>branch<\/code> \u7684\u8def\u5f84\u4e0a\u7684\u6240\u6709 <code>commit<\/code>s \u4e5f\u4e00\u5e76\u4e0a\u4f20\u3002<\/li>\n\n\n\n<li><code>push<\/code> \u7684\u65f6\u5019\uff0c\u5982\u679c\u5f53\u524d\u5206\u652f\u662f\u4e00\u4e2a\u672c\u5730\u521b\u5efa\u7684\u5206\u652f\uff0c\u9700\u8981\u6307\u5b9a\u8fdc\u7a0b\u4ed3\u5e93\u540d\u548c\u5206\u652f\u540d\uff0c\u7528 <code>git push origin branch_name<\/code> \u7684\u683c\u5f0f\uff0c\u800c\u4e0d\u80fd\u53ea\u7528 <code>git push<\/code>\uff1b\u6216\u8005\u53ef\u4ee5\u901a\u8fc7 <code>git config<\/code> \u4fee\u6539 <code>push.default<\/code> \u6765\u6539\u53d8 <code>push<\/code> \u65f6\u7684\u884c\u4e3a\u903b\u8f91\u3002<\/li>\n\n\n\n<li><code>push<\/code> \u7684\u65f6\u5019\u4e4b\u540e\u4e0a\u4f20\u5f53\u524d\u5206\u652f\uff0c\u5e76\u4e0d\u4f1a\u4e0a\u4f20 <code>HEAD<\/code>\uff1b\u8fdc\u7a0b\u4ed3\u5e93\u7684 <code>HEAD<\/code> \u662f\u6c38\u8fdc\u6307\u5411\u9ed8\u8ba4\u5206\u652f\uff08\u5373 <code>master<\/code>\uff09\u7684\u3002<\/li>\n\n\n\n<li><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898 commit\u5230\u672c\u5730\u4ed3\u5e93\u7684\u65f6\u5019\u53ef\u80fd\u5df2\u7ecf\u63d0\u4ea4\u8fc7\u597d\u51e0\u7248\u4e86\uff0c\u4f46\u662f\u5f80\u670d\u52a1\u5668push\u7684\u65f6\u5019\u4e0d\u9700\u8981\u5168\u90e8\u90fdpush\uff0cgi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/16037"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16037"}],"version-history":[{"count":2,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/16037\/revisions"}],"predecessor-version":[{"id":16043,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/16037\/revisions\/16043"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16037"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16037"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}