{"id":670681,"date":"2024-07-19T14:05:02","date_gmt":"2024-07-19T06:05:02","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/670681.html"},"modified":"2024-07-19T14:05:04","modified_gmt":"2024-07-19T06:05:04","slug":"%e5%a4%9a%e4%ba%ba%e5%8d%8f%e4%bd%9cgit%e6%80%8e%e4%b9%88pull%e5%92%8cpush","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/670681.html","title":{"rendered":"\u591a\u4eba\u534f\u4f5cgit\u600e\u4e48pull\u548cpush"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/07\/1b92875b-e2e3-4296-b49c-429c06f7e774.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\u591a\u4eba\u534f\u4f5cgit\u600e\u4e48pull\u548cpush\" \/><\/p>\n<p><p>\u5728\u591a\u4eba\u534f\u4f5c\u7684Git\u9879\u76ee\u4e2d\uff0c\u8fdb\u884cPull\u548cPush\u64cd\u4f5c\u7684\u6b65\u9aa4\u4e3b\u8981\u5305\u62ec\uff1a\u4e00\u3001\u4e3a\u9879\u76ee\u521b\u5efa\u4e00\u4e2a\u5171\u4eab\u7684\u4e2d\u5fc3\u4ed3\u5e93\uff1b\u4e8c\u3001\u6bcf\u4e2a\u6210\u5458\u514b\u9686\u4e2d\u5fc3\u4ed3\u5e93\u5230\u672c\u5730\uff1b\u4e09\u3001\u5728\u672c\u5730\u521b\u5efa\u548c\u5207\u6362\u5230\u65b0\u7684\u5f00\u53d1\u5206\u652f\uff1b\u56db\u3001\u5728\u65b0\u5206\u652f\u4e0a\u8fdb\u884c\u5f00\u53d1\u5e76\u63d0\u4ea4\u66f4\u6539\uff1b\u4e94\u3001\u5c06\u65b0\u5206\u652f\u63a8\u9001\u5230\u4e2d\u5fc3\u4ed3\u5e93\uff1b\u516d\u3001\u5728\u4e2d\u5fc3\u4ed3\u5e93\u4e0a\u8fdb\u884c\u5408\u5e76\u64cd\u4f5c\uff1b\u4e03\u3001\u5176\u4ed6\u6210\u5458\u62c9\u53d6\u4e2d\u5fc3\u4ed3\u5e93\u7684\u6700\u65b0\u66f4\u6539\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u89e3\u6790\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p><strong>\u4e00\u3001\u521b\u5efa\u5171\u4eab\u7684\u4e2d\u5fc3\u4ed3\u5e93<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u591a\u4eba\u534f\u4f5c\u7684Git\u9879\u76ee\u4e2d\uff0c\u4e00\u822c\u4f1a\u6709\u4e00\u4e2a\u5171\u4eab\u7684\u4e2d\u5fc3\u4ed3\u5e93\uff0c\u6240\u6709\u7684\u6210\u5458\u90fd\u53ef\u4ee5\u5c06\u66f4\u6539\u63a8\u9001\u5230\u8fd9\u4e2a\u4ed3\u5e93\u4e2d\uff0c\u5e76\u4ece\u4e2d\u62c9\u53d6\u6700\u65b0\u7684\u66f4\u6539\u3002\u8fd9\u4e2a\u4e2d\u5fc3\u4ed3\u5e93\u53ef\u4ee5\u662f\u5728GitHub\u3001GitLab\u3001Bitbucket\u7b49\u5e73\u53f0\u4e0a\u521b\u5efa\u7684\u8fdc\u7a0b\u4ed3\u5e93\u3002<\/p>\n<\/p>\n<p><p><strong>\u4e8c\u3001\u514b\u9686\u4e2d\u5fc3\u4ed3\u5e93\u5230\u672c\u5730<\/strong><\/p>\n<\/p>\n<p><p>\u6bcf\u4e2a\u6210\u5458\u9700\u8981\u5c06\u4e2d\u5fc3\u4ed3\u5e93\u514b\u9686\u5230\u672c\u5730\uff0c\u8fd9\u6837\u624d\u80fd\u5728\u672c\u5730\u8fdb\u884c\u5f00\u53d1\u3002\u514b\u9686\u64cd\u4f5c\u53ef\u4ee5\u4f7f\u7528&quot;git clone&quot;\u547d\u4ee4\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code>git clone https:\/\/github.com\/username\/repository.git<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u4e09\u3001\u521b\u5efa\u548c\u5207\u6362\u5230\u65b0\u7684\u5f00\u53d1\u5206\u652f<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u672c\u5730\u4ed3\u5e93\u4e2d\uff0c\u6bcf\u4e2a\u6210\u5458\u90fd\u5e94\u8be5\u4e3a\u81ea\u5df1\u7684\u5f00\u53d1\u4efb\u52a1\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5206\u652f\uff0c\u5e76\u5728\u8fd9\u4e2a\u5206\u652f\u4e0a\u8fdb\u884c\u5f00\u53d1\u3002\u5206\u652f\u7684\u521b\u5efa\u548c\u5207\u6362\u53ef\u4ee5\u4f7f\u7528&quot;git branch&quot;\u548c&quot;git checkout&quot;\u547d\u4ee4\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code>git branch new-feature<\/p>\n<p>git checkout new-feature<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u56db\u3001\u5728\u65b0\u5206\u652f\u4e0a\u8fdb\u884c\u5f00\u53d1\u5e76\u63d0\u4ea4\u66f4\u6539<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u65b0\u7684\u5206\u652f\u4e0a\uff0c\u6210\u5458\u53ef\u4ee5\u8fdb\u884c\u5f00\u53d1\u5de5\u4f5c\uff0c\u5b8c\u6210\u540e\u63d0\u4ea4\u66f4\u6539\u3002\u63d0\u4ea4\u66f4\u6539\u53ef\u4ee5\u4f7f\u7528&quot;git add&quot;\u548c&quot;git commit&quot;\u547d\u4ee4\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code>git add .<\/p>\n<p>git commit -m &quot;Add new feature&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u4e94\u3001\u5c06\u65b0\u5206\u652f\u63a8\u9001\u5230\u4e2d\u5fc3\u4ed3\u5e93<\/strong><\/p>\n<\/p>\n<p><p>\u5c06\u672c\u5730\u7684\u65b0\u5206\u652f\u63a8\u9001\u5230\u4e2d\u5fc3\u4ed3\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528&quot;git push&quot;\u547d\u4ee4\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code>git push origin new-feature<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u516d\u3001\u5728\u4e2d\u5fc3\u4ed3\u5e93\u4e0a\u8fdb\u884c\u5408\u5e76\u64cd\u4f5c<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u4e2d\u5fc3\u4ed3\u5e93\u4e0a\uff0c\u9879\u76ee\u7684\u7ef4\u62a4\u8005\u53ef\u4ee5\u5c06\u65b0\u7684\u66f4\u6539\u5408\u5e76\u5230\u4e3b\u5206\u652f\u4e0a\u3002\u8fd9\u4e2a\u64cd\u4f5c\u53ef\u4ee5\u5728GitHub\u7b49\u5e73\u53f0\u4e0a\u8fdb\u884c\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528&quot;git merge&quot;\u547d\u4ee4\u3002<\/p>\n<\/p>\n<p><p><strong>\u4e03\u3001\u5176\u4ed6\u6210\u5458\u62c9\u53d6\u4e2d\u5fc3\u4ed3\u5e93\u7684\u6700\u65b0\u66f4\u6539<\/strong><\/p>\n<\/p>\n<p><p>\u5176\u4ed6\u6210\u5458\u53ef\u4ee5\u4f7f\u7528&quot;git pull&quot;\u547d\u4ee4\u62c9\u53d6\u4e2d\u5fc3\u4ed3\u5e93\u7684\u6700\u65b0\u66f4\u6539\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code>git pull origin master<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4ee5\u4e0a\u5c31\u662f\u5728\u591a\u4eba\u534f\u4f5c\u7684Git\u9879\u76ee\u4e2d\uff0c\u8fdb\u884cPull\u548cPush\u64cd\u4f5c\u7684\u8be6\u7ec6\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u5982\u4f55\u5728\u591a\u4eba\u534f\u4f5c\u7684git\u9879\u76ee\u4e2d\u8fdb\u884cpull\u64cd\u4f5c\uff1f<\/strong><br \/>\n\u5728\u591a\u4eba\u534f\u4f5c\u7684git\u9879\u76ee\u4e2d\uff0c\u6267\u884cpull\u64cd\u4f5c\u53ef\u4ee5\u5c06\u8fdc\u7a0b\u4ed3\u5e93\u7684\u6700\u65b0\u4ee3\u7801\u540c\u6b65\u5230\u672c\u5730\u3002\u8981\u8fdb\u884cpull\u64cd\u4f5c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<ul>\n<li>\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u5e76\u8fdb\u5165\u672c\u5730\u9879\u76ee\u76ee\u5f55\u3002<\/li>\n<li>\u4f7f\u7528\u547d\u4ee4 <code>git pull origin &lt;branch_name&gt;<\/code>\uff0c\u5176\u4e2d<code>&lt;branch_name&gt;<\/code>\u662f\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5206\u652f\u540d\u79f0\uff0c\u4f8b\u5982<code>master<\/code>\u3002<\/li>\n<li>Git\u4f1a\u81ea\u52a8\u4ece\u8fdc\u7a0b\u4ed3\u5e93\u4e0b\u8f7d\u6700\u65b0\u7684\u4ee3\u7801\u5e76\u5408\u5e76\u5230\u5f53\u524d\u5206\u652f\u3002<\/li>\n<\/ul>\n<p><strong>2. \u5f53\u591a\u4eba\u534f\u4f5cgit\u9879\u76ee\u4e2d\u6709\u51b2\u7a81\u65f6\uff0c\u5982\u4f55\u5904\u7406push\u64cd\u4f5c\uff1f<\/strong><br \/>\n\u5728\u591a\u4eba\u534f\u4f5c\u7684git\u9879\u76ee\u4e2d\uff0c\u5f53\u591a\u4e2a\u4eba\u5bf9\u540c\u4e00\u6587\u4ef6\u8fdb\u884c\u4fee\u6539\u5e76\u63d0\u4ea4\u65f6\uff0c\u53ef\u80fd\u4f1a\u53d1\u751f\u51b2\u7a81\u3002\u8981\u5904\u7406push\u64cd\u4f5c\u4e2d\u7684\u51b2\u7a81\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\uff1a<\/p>\n<ul>\n<li>\u9996\u5148\uff0c\u6267\u884c <code>git pull origin &lt;branch_name&gt;<\/code> \u547d\u4ee4\uff0c\u5c06\u8fdc\u7a0b\u4ed3\u5e93\u7684\u6700\u65b0\u4ee3\u7801\u62c9\u53d6\u5230\u672c\u5730\u3002<\/li>\n<li>Git\u4f1a\u81ea\u52a8\u68c0\u6d4b\u5230\u51b2\u7a81\u7684\u6587\u4ef6\uff0c\u5e76\u5728\u4ee3\u7801\u4e2d\u7528\u7279\u6b8a\u6807\u8bb0\u6807\u8bb0\u51fa\u6765\u3002\u624b\u52a8\u7f16\u8f91\u8fd9\u4e9b\u6587\u4ef6\uff0c\u89e3\u51b3\u51b2\u7a81\u3002<\/li>\n<li>\u4fdd\u5b58\u4fee\u6539\u540e\u7684\u6587\u4ef6\uff0c\u5e76\u6267\u884c <code>git add &lt;conflicted_file&gt;<\/code> \u547d\u4ee4\uff0c\u5c06\u89e3\u51b3\u51b2\u7a81\u540e\u7684\u6587\u4ef6\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u3002<\/li>\n<li>\u6700\u540e\uff0c\u6267\u884c <code>git commit -m &quot;Resolved conflicts&quot;<\/code> \u547d\u4ee4\uff0c\u63d0\u4ea4\u89e3\u51b3\u51b2\u7a81\u540e\u7684\u4ee3\u7801\u3002<\/li>\n<li>\u5b8c\u6210\u4ee5\u4e0a\u6b65\u9aa4\u540e\uff0c\u53ef\u4ee5\u7ee7\u7eed\u6267\u884c <code>git push origin &lt;branch_name&gt;<\/code> \u547d\u4ee4\uff0c\u5c06\u4ee3\u7801\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u3002<\/li>\n<\/ul>\n<p><strong>3. \u5982\u4f55\u5728\u591a\u4eba\u534f\u4f5c\u7684git\u9879\u76ee\u4e2d\u4fdd\u6301\u4ee3\u7801\u540c\u6b65\uff1f<\/strong><br \/>\n\u5728\u591a\u4eba\u534f\u4f5c\u7684git\u9879\u76ee\u4e2d\uff0c\u4e3a\u4e86\u4fdd\u6301\u4ee3\u7801\u540c\u6b65\uff0c\u53ef\u4ee5\u91c7\u53d6\u4ee5\u4e0b\u63aa\u65bd\uff1a<\/p>\n<ul>\n<li>\u5b9a\u671f\u6267\u884c <code>git pull origin &lt;branch_name&gt;<\/code> \u547d\u4ee4\uff0c\u5c06\u8fdc\u7a0b\u4ed3\u5e93\u7684\u6700\u65b0\u4ee3\u7801\u62c9\u53d6\u5230\u672c\u5730\u3002<\/li>\n<li>\u5728\u5f00\u59cb\u5de5\u4f5c\u4e4b\u524d\uff0c\u786e\u4fdd\u672c\u5730\u4ee3\u7801\u662f\u6700\u65b0\u7684\uff0c\u5e76\u4e14\u4e0e\u8fdc\u7a0b\u4ed3\u5e93\u4fdd\u6301\u4e00\u81f4\u3002<\/li>\n<li>\u5728\u8fdb\u884c\u8f83\u5927\u7684\u4fee\u6539\u4e4b\u524d\uff0c\u5148\u4e0e\u56e2\u961f\u6210\u5458\u8fdb\u884c\u6c9f\u901a\uff0c\u907f\u514d\u591a\u4eba\u540c\u65f6\u4fee\u6539\u540c\u4e00\u6587\u4ef6\u5bfc\u81f4\u51b2\u7a81\u3002<\/li>\n<li>\u5728\u63d0\u4ea4\u4ee3\u7801\u4e4b\u524d\uff0c\u5148\u6267\u884c <code>git pull origin &lt;branch_name&gt;<\/code> \u547d\u4ee4\uff0c\u786e\u4fdd\u672c\u5730\u4ee3\u7801\u4e0e\u8fdc\u7a0b\u4ed3\u5e93\u4fdd\u6301\u540c\u6b65\u3002<\/li>\n<li>\u5982\u679c\u9047\u5230\u51b2\u7a81\uff0c\u6839\u636e\u524d\u9762\u63d0\u5230\u7684\u6b65\u9aa4\u89e3\u51b3\u51b2\u7a81\uff0c\u5e76\u53ca\u65f6\u4e0e\u56e2\u961f\u6210\u5458\u8fdb\u884c\u534f\u5546\u3002<\/li>\n<\/ul>\n<p>\u5e0c\u671b\u4ee5\u4e0a\u89e3\u7b54\u5bf9\u60a8\u6709\u5e2e\u52a9\u3002\u5982\u679c\u60a8\u8fd8\u6709\u5176\u4ed6\u95ee\u9898\uff0c\u8bf7\u968f\u65f6\u63d0\u95ee\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728\u591a\u4eba\u534f\u4f5c\u7684Git\u9879\u76ee\u4e2d\uff0c\u8fdb\u884cPull\u548cPush\u64cd\u4f5c\u7684\u6b65\u9aa4\u4e3b\u8981\u5305\u62ec\uff1a\u4e00\u3001\u4e3a\u9879\u76ee\u521b\u5efa\u4e00\u4e2a\u5171\u4eab\u7684\u4e2d\u5fc3\u4ed3\u5e93\uff1b\u4e8c\u3001\u6bcf\u4e2a [&hellip;]","protected":false},"author":3,"featured_media":670682,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/670681"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=670681"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/670681\/revisions"}],"predecessor-version":[{"id":670683,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/670681\/revisions\/670683"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/670682"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=670681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=670681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=670681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}