{"id":7684,"date":"2016-04-01T16:03:22","date_gmt":"2016-04-01T08:03:22","guid":{"rendered":"http:\/\/jpuyy.com\/?p=7684"},"modified":"2016-04-01T16:15:27","modified_gmt":"2016-04-01T08:15:27","slug":"git-%e5%9c%a8%e6%af%8f%e4%b8%80%e6%ac%a1-commit-%e4%b8%ad%e6%b8%85%e7%90%86%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=7684","title":{"rendered":"git \u5728\u6bcf\u4e00\u6b21 commit \u4e2d\u6e05\u7406\u6587\u4ef6"},"content":{"rendered":"<p>\u6709\u4e24\u4e2a\u5f88\u5927\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u5728\u7248\u672c\u5e93\u4e2d\u6ca1\u6709\u4e00\u70b9\u7528\u5904\u3002<br \/>\n\u4f7f\u7528\u6838\u6b66\u5668 filter-branch \uff0c\u5c06\u6bcf\u4e00\u6b21\u63d0\u4ea4\u4e2d\u51fa\u73b0\u8fd9\u4e24\u4e2a\u6587\u4ef6\u7684\u65f6\u5019\u5220\u6389\uff0c\u7136\u540e\u91cd\u65b0\u63d0\u4ea4\uff0c\u6240\u4ee5 commit \u7684 hash \u503c\u90fd\u4f1a\u53d8\u6389\u3002<\/p>\n<pre>git filter-branch -f --tree-filter 'rm -f nginx\/files\/GeoLiteCity.dat nginx\/files\/GeoIP.dat' HEAD<\/pre>\n<p>\u5f3a\u5236 push \u5230 origin<\/p>\n<pre>git push origin --force<\/pre>\n<p>\u4f60\u7684\u5408\u4f5c\u8005\u73b0\u5728\u6df7\u4e71\u4e86\u3002\u9700\u8981\u5c06\u8fdc\u7aef\u7684 master rebase \u8fc7\u6765<\/p>\n<pre>git rebase --onto origin\/master master master<\/pre>\n<pre>git fetch<\/pre>\n<pre>git reset --hard origin\/master<\/pre>\n<p>\u5f3a\u5236 pull \u4e0b\u6765<\/p>\n<pre>git pull --force<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u4e24\u4e2a\u5f88\u5927\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u5728\u7248\u672c\u5e93\u4e2d\u6ca1\u6709\u4e00\u70b9\u7528\u5904\u3002 \u4f7f\u7528\u6838\u6b66\u5668 filter-branch \uff0c\u5c06\u6bcf\u4e00\u6b21\u63d0\u4ea4\u4e2d\u51fa\u73b0\u8fd9\u4e24\u4e2a\u6587\u4ef6\u7684\u65f6\u5019\u5220\u6389\uff0c\u7136\u540e\u91cd\u65b0\u63d0\u4ea4\uff0c\u6240\u4ee5 commit \u7684 hash \u503c\u90fd\u4f1a\u53d8\u6389\u3002 git filter-branch -f &#8211;tree-filter &#8216;rm -f nginx\/files\/GeoLiteCity.dat nginx\/files\/GeoIP.dat&#8217; HEAD \u5f3a\u5236 push \u5230 origin git push origin &#8211;force \u4f60\u7684\u5408\u4f5c\u8005\u73b0\u5728\u6df7\u4e71\u4e86\u3002\u9700\u8981\u5c06\u8fdc\u7aef\u7684 master rebase \u8fc7\u6765 git rebase &#8211;onto origin\/master master master git fetch git reset &#8211;hard origin\/master \u5f3a\u5236 pull \u4e0b\u6765 git pull &#8211;force<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[168],"tags":[],"class_list":["post-7684","post","type-post","status-publish","format-standard","hentry","category-git"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7684"}],"version-history":[{"count":3,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7684\/revisions"}],"predecessor-version":[{"id":7687,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7684\/revisions\/7687"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}