{"id":21574,"date":"2024-11-19T16:02:04","date_gmt":"2024-11-19T08:02:04","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21574\/"},"modified":"2024-11-19T16:02:04","modified_gmt":"2024-11-19T08:02:04","slug":"git%e6%80%8e%e4%b9%88%e5%bc%ba%e5%88%b6push","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21574\/","title":{"rendered":"git\u600e\u4e48\u5f3a\u5236push"},"content":{"rendered":"<blockquote><p>\n  \u5f3a\u5236\u63a8\u9001\u662f\u4e00\u79cd\u5c06\u672c\u5730\u66f4\u6539\u5f3a\u5236\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u7684\u64cd\u4f5c\u3002\u6b65\u9aa4\u5305\u62ec\uff1a1. \u68c0\u67e5\u662f\u5426\u5b58\u5728\u51b2\u7a81\uff1b2. \u4f7f\u7528 -f \u6807\u5fd7\u5ffd\u7565\u51b2\u7a81\uff1b3. \u63d0\u4ea4\u5f3a\u5236\u63a8\u9001\uff1b4. \u5982\u679c\u6709\u51b2\u7a81\uff0c\u624b\u52a8\u89e3\u51b3\u51b2\u7a81\u5e76\u518d\u6b21\u63a8\u9001\u3002\u5f3a\u5236\u63a8\u9001\u5e94\u8c28\u614e\u4f7f\u7528\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u8986\u76d6\u4ed6\u4eba\u7684\u66f4\u6539\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/31\/2024053100314515041.jpg\" class=\"aligncenter\" title=\"git\u600e\u4e48\u5f3a\u5236push\u63d2\u56fe\" alt=\"git\u600e\u4e48\u5f3a\u5236push\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5f3a\u5236\u63a8\u9001 Git \u66f4\u6539<\/strong><\/p>\n<p><strong>\u6982\u89c8\uff1a<\/strong><br \/>\u5f3a\u5236\u63a8\u9001\u662f\u4e00\u79cd\u5c06\u672c\u5730\u66f4\u6539\u5f3a\u5236\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u7684\u64cd\u4f5c\uff0c\u5373\u4f7f\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u5b58\u5728\u51b2\u7a81\u3002<\/p>\n<p><strong>\u5f3a\u5236\u63a8\u9001\u6b65\u9aa4\uff1a<\/strong><\/p>\n<p><strong>1. \u68c0\u67e5\u51b2\u7a81\uff1a<\/strong><br \/>\u5728\u5c1d\u8bd5\u5f3a\u5236\u63a8\u9001\u4e4b\u524d\uff0c\u52a1\u5fc5\u68c0\u67e5\u662f\u5426\u5b58\u5728\u51b2\u7a81\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git status<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u5ffd\u7565\u51b2\u7a81\uff1a<\/strong><br \/>\u5982\u679c\u5b58\u5728\u51b2\u7a81\uff0c\u53ef\u4ee5\u4f7f\u7528 -f \u6807\u5fd7\u5ffd\u7565\u5b83\u4eec\u5e76\u5f3a\u5236\u63a8\u9001\uff1a<\/p>\n<pre>git push -f<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u63d0\u4ea4\u5f3a\u5236\u63a8\u9001\uff1a<\/strong><br \/>\u5f3a\u5236\u63a8\u9001\u540e\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u8981\u6c42\u63d0\u4ea4\u5f3a\u5236\u63a8\u9001\u7684\u63d0\u793a\u3002\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u63d0\u4ea4\uff1a<\/p>\n<pre>git push origin HEAD -f<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u89e3\u51b3\u51b2\u7a81\uff08\u53ef\u9009\uff09\uff1a<\/strong><br \/>\u5f3a\u5236\u63a8\u9001\u540e\uff0c\u5e94\u5c3d\u5feb\u89e3\u51b3\u4efb\u4f55\u51b2\u7a81\u3002\u53ef\u4ee5\u7f16\u8f91\u6709\u51b2\u7a81\u7684\u6587\u4ef6\uff0c\u624b\u52a8\u89e3\u51b3\u51b2\u7a81\uff0c\u7136\u540e\u63d0\u4ea4\u66f4\u6539\uff1a<\/p>\n<pre>git add &lt;\u6587\u4ef6&gt;\ngit commit -m \"\u89e3\u51b3\u51b2\u7a81\"\ngit push<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6ce8\u610f\u4e8b\u9879\uff1a<\/strong><\/p>\n<ul>\n<li>\u5f3a\u5236\u63a8\u9001\u4ec5\u5e94\u5728\u7279\u6b8a\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u4f8b\u5982\u9700\u8981\u8986\u76d6\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u7684\u66f4\u6539\u6216\u89e3\u51b3\u51b2\u7a81\u65f6\u3002<\/li>\n<li>\u5f3a\u5236\u63a8\u9001\u53ef\u80fd\u4f1a\u8986\u76d6\u4ed6\u4eba\u7684\u66f4\u6539\uff0c\u56e0\u6b64\u5e94\u8c28\u614e\u4f7f\u7528\u3002<\/li>\n<li>\u5982\u679c\u8fdc\u7a0b\u4ed3\u5e93\u6709\u91cd\u8981\u66f4\u6539\uff0c\u4e0d\u5efa\u8bae\u5f3a\u5236\u63a8\u9001\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5f3a\u5236push\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f3a\u5236\u63a8\u9001\u662f\u4e00\u79cd\u5c06\u672c\u5730\u66f4\u6539\u5f3a\u5236\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u7684\u64cd\u4f5c\u3002\u6b65\u9aa4\u5305\u62ec\uff1a1. \u68c0\u67e5\u662f\u5426\u5b58\u5728\u51b2\u7a81\uff1b2. \u4f7f\u7528 -f \u6807\u5fd7\u5ffd\u7565\u51b2\u7a81\uff1b3. \u63d0\u4ea4\u5f3a\u5236\u63a8\u9001\uff1b4. \u5982\u679c\u6709\u51b2\u7a81\uff0c\u624b\u52a8\u89e3\u51b3\u51b2\u7a81\u5e76\u518d\u6b21\u63a8\u9001\u3002\u5f3a\u5236\u63a8\u9001\u5e94\u8c28\u614e\u4f7f\u7528\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u8986\u76d6\u4ed6\u4eba\u7684\u66f4\u6539\u3002 \u5982\u4f55\u5f3a\u5236\u63a8\u9001 Git \u66f4\u6539 \u6982\u89c8\uff1a\u5f3a\u5236\u63a8\u9001\u662f\u4e00\u79cd\u5c06\u672c\u5730\u66f4\u6539\u5f3a\u5236\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u7684\u64cd\u4f5c\uff0c\u5373\u4f7f\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u5b58\u5728\u51b2\u7a81\u3002 \u5f3a\u5236\u63a8\u9001\u6b65\u9aa4\uff1a 1. \u68c0\u67e5\u51b2\u7a81\uff1a\u5728\u5c1d\u8bd5\u5f3a\u5236\u63a8\u9001\u4e4b\u524d\uff0c\u52a1\u5fc5\u68c0\u67e5\u662f\u5426\u5b58\u5728\u51b2\u7a81\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a git status \u767b\u5f55\u540e\u590d\u5236 2. \u5ffd\u7565\u51b2\u7a81\uff1a\u5982\u679c\u5b58\u5728\u51b2\u7a81\uff0c\u53ef\u4ee5\u4f7f\u7528 -f \u6807\u5fd7\u5ffd\u7565\u5b83\u4eec\u5e76\u5f3a\u5236\u63a8\u9001\uff1a git push -f \u767b\u5f55\u540e\u590d\u5236 3. \u63d0\u4ea4\u5f3a\u5236\u63a8\u9001\uff1a\u5f3a\u5236\u63a8\u9001\u540e\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u8981\u6c42\u63d0\u4ea4\u5f3a\u5236\u63a8\u9001\u7684\u63d0\u793a\u3002\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u63d0\u4ea4\uff1a git push origin HEAD -f \u767b\u5f55\u540e\u590d\u5236 4. \u89e3\u51b3\u51b2\u7a81\uff08\u53ef\u9009\uff09\uff1a\u5f3a\u5236\u63a8\u9001\u540e\uff0c\u5e94\u5c3d\u5feb\u89e3\u51b3\u4efb\u4f55\u51b2\u7a81\u3002\u53ef\u4ee5\u7f16\u8f91\u6709\u51b2\u7a81\u7684\u6587\u4ef6\uff0c\u624b\u52a8\u89e3\u51b3\u51b2\u7a81\uff0c\u7136\u540e\u63d0\u4ea4\u66f4\u6539\uff1a git add &lt;\u6587\u4ef6&gt; git commit -m &#8220;\u89e3\u51b3\u51b2\u7a81&#8221; git push \u767b\u5f55\u540e\u590d\u5236 \u6ce8\u610f\u4e8b\u9879\uff1a \u5f3a\u5236\u63a8\u9001\u4ec5\u5e94\u5728\u7279\u6b8a\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u4f8b\u5982\u9700\u8981\u8986\u76d6\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u7684\u66f4\u6539\u6216\u89e3\u51b3\u51b2\u7a81\u65f6\u3002 \u5f3a\u5236\u63a8\u9001\u53ef\u80fd\u4f1a\u8986\u76d6\u4ed6\u4eba\u7684\u66f4\u6539\uff0c\u56e0\u6b64\u5e94\u8c28\u614e\u4f7f\u7528\u3002 \u5982\u679c\u8fdc\u7a0b\u4ed3\u5e93\u6709\u91cd\u8981\u66f4\u6539\uff0c\u4e0d\u5efa\u8bae\u5f3a\u5236\u63a8\u9001\u3002 \u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5f3a\u5236push\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-21574","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=21574"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21574\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}