{"id":508,"date":"2024-08-12T17:39:45","date_gmt":"2024-08-12T09:39:45","guid":{"rendered":"https:\/\/thereisno.top:4430\/?p=508"},"modified":"2024-08-12T17:39:45","modified_gmt":"2024-08-12T09:39:45","slug":"%e5%88%a0%e9%99%a4git%e4%bb%93%e5%ba%93%e6%89%80%e6%9c%89%e6%8f%90%e4%ba%a4%e5%8e%86%e5%8f%b2%e8%ae%b0%e5%bd%95%ef%bc%8c%e6%88%90%e4%b8%ba%e4%b8%80%e4%b8%aa%e5%b9%b2%e5%87%80%e7%9a%84%e6%96%b0","status":"publish","type":"post","link":"https:\/\/thereisno.top\/?p=508","title":{"rendered":"\u5220\u9664Git\u4ed3\u5e93\u6240\u6709\u63d0\u4ea4\u5386\u53f2\u8bb0\u5f55\uff0c\u6210\u4e3a\u4e00\u4e2a\u5e72\u51c0\u7684\u65b0\u4ed3\u5e93"},"content":{"rendered":"\n<p>\u573a\u666f<\/p>\n\n\n\n<p>\u628a\u65e7\u9879\u76ee\u63d0\u4ea4\u5230Git\u4e0a\uff0c\u4f46\u662f\u4f1a\u6709\u4e00\u4e9b\u5386\u53f2\u8bb0\u5f55\uff0c\u8fd9\u4e9b\u5386\u53f2\u8bb0\u5f55\u4e2d\u53ef\u80fd\u4f1a\u6709\u9879\u76ee\u5bc6\u7801\u7b49\u654f\u611f\u4fe1\u606f\u3002\u5982\u4f55\u5220\u9664\u8fd9\u4e9b\u5386\u53f2\u8bb0\u5f55\uff0c\u5f62\u6210\u4e00\u4e2a\u5168\u65b0\u7684\u4ed3\u5e93\uff0c\u5e76\u4e14\u4fdd\u6301\u4ee3\u7801\u4e0d\u53d8\u5462\uff1f<\/p>\n\n\n\n<p>\u64cd\u4f5c<\/p>\n\n\n\n<p>Checkout<\/p>\n\n\n\n<p>git checkout &#8211;orphan latest_branch<\/p>\n\n\n\n<p>Add all the files<\/p>\n\n\n\n<p>git <strong>add<\/strong> -A<\/p>\n\n\n\n<p>Commit the changes<\/p>\n\n\n\n<p>git commit -am &#8220;commit message&#8221;<\/p>\n\n\n\n<p>Delete the branch<\/p>\n\n\n\n<p>git <strong>branch <\/strong>-D master<\/p>\n\n\n\n<p>Rename the current branch to master<\/p>\n\n\n\n<p>git <strong>branch <\/strong>-m master<\/p>\n\n\n\n<p>Finally, force update your repository<\/p>\n\n\n\n<p>git push -f origin master<\/p>\n\n\n\n<p>\u5f3a\u5236pull\u8fdc\u7aef\u8986\u76d6\u672c\u5730\u6587\u4ef6<\/p>\n\n\n\n<p>git fetch &#8211;all&nbsp;<\/p>\n\n\n\n<p>git reset &#8211;hard origin\/master<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u573a\u666f \u628a\u65e7\u9879\u76ee\u63d0\u4ea4\u5230Git\u4e0a\uff0c\u4f46\u662f\u4f1a\u6709\u4e00\u4e9b\u5386\u53f2\u8bb0\u5f55\uff0c\u8fd9\u4e9b\u5386\u53f2\u8bb0\u5f55\u4e2d\u53ef\u80fd\u4f1a\u6709\u9879\u76ee\u5bc6\u7801\u7b49\u654f\u611f\u4fe1\u606f\u3002\u5982\u4f55\u5220\u9664\u8fd9\u4e9b\u5386\u53f2 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/thereisno.top\/?p=508\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u5220\u9664Git\u4ed3\u5e93\u6240\u6709\u63d0\u4ea4\u5386\u53f2\u8bb0\u5f55\uff0c\u6210\u4e3a\u4e00\u4e2a\u5e72\u51c0\u7684\u65b0\u4ed3\u5e93\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[2],"class_list":["post-508","post","type-post","status-publish","format-standard","hentry","category-git","tag-git"],"_links":{"self":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=508"}],"version-history":[{"count":1,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/508\/revisions"}],"predecessor-version":[{"id":509,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/508\/revisions\/509"}],"wp:attachment":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}