{"id":233469,"date":"2020-12-29T00:46:07","date_gmt":"2020-12-28T16:46:07","guid":{"rendered":"http:\/\/4563.org\/?p=233469"},"modified":"2020-12-29T00:46:07","modified_gmt":"2020-12-28T16:46:07","slug":"git-%e5%88%86%e7%a6%bb%e5%ad%90%e6%96%87%e4%bb%b6%e5%a4%b9%e5%af%bc%e8%87%b4%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=233469","title":{"rendered":"git \u5206\u79bb\u5b50\u6587\u4ef6\u5939\u5bfc\u81f4\u7684\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  git \u5206\u79bb\u5b50\u6587\u4ef6\u5939\u5bfc\u81f4\u7684\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : JCZ2MkKb5S8ZX9pq <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<ul>\n<li>\n<p>\u6709\u4e00\u4e2a\u9879\u76ee\u6587\u4ef6\u5939 Parent\uff0c\u5176\u4e2d\u6709\u4e00\u4e2a child \u6587\u4ef6\u5939\u3002Parent \u5df2\u7ecf\u5386\u8fc7\u591a\u6b21 commit\uff0c\u5e0c\u671b\u5206\u79bb child \u4e3a\u5b64\u7acb\u7684 git \u3002<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528\u7684\u65b9\u6cd5\u662f\uff1a<\/p>\n<ul>\n<li>\u590d\u5236 Parent \u4e3a\u526f\u672c<\/li>\n<li>\u5728\u526f\u672c\u5185\u8fc7\u6ee4 git filter-branch &#8211;prune-empty &#8211;subdirectory-filter child<\/li>\n<li>\u8fd9\u6837\u83b7\u5f97\u7684 child \u770b\u4e0a\u53bb\u662f\u5bf9\u7684<\/li>\n<li>\u518d\u53bb parent \u91cc ignore \u6389 child \u5c31\u597d\u4e86<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4f46\u662f\u9694\u4e86\u597d\u4e45\uff0c\u53d1\u73b0\u6709\u95ee\u9898\u3002\u56e0\u4e3a Parent \u4e4b\u524d commit \u591a\u6b21\uff0c\u800c\u4e14\u6709\u8bef\u64cd\u4f5c\uff0ccommit \u4e86\u5927\u6587\u4ef6\u8fdb\u53bb\u3002child \u53ea\u6709 20M\uff0cgit \u6709 200M+\u3002\u7528\u4e86\u5b98\u65b9\u63a8\u8350\u7684 BFG\uff0c\u7684\u786e\u80fd\u5220\u9664\u5927\u6587\u4ef6\uff0c\u7f29\u51cf\u5230 100M\uff0c\u4f46\u8fd8\u662f\u5f88\u5927\u3002<\/p>\n<\/li>\n<li>\n<p>\u731c\u6d4b\u53ef\u80fd\u662f filter \u7684\u95ee\u9898\uff0cchild \u4ee5\u5916\u7684\u5b50\u6587\u4ef6\u5939\u7684 git \u8bb0\u5f55\u8fd8\u5728\uff0c\u867d\u7136\u6ca1\u6709\u5927\u6587\u4ef6\uff0c\u4f46\u4e5f\u79ef\u5c11\u6210\u591a\u3002<\/p>\n<\/li>\n<\/ul>\n<h1>\u63d0\u95ee<\/h1>\n<p> <\/p>\n<ul>\n<li>\n<p>\u73b0\u5728\u8fd8\u6709\u6ca1\u6709\u529e\u6cd5\u7406\u6e05 child \u7684 commit\uff0c\u4f7f\u5176\u6446\u8131 parent \u7684\u9057\u6bd2\u3002<\/p>\n<\/li>\n<li>\n<p>\u7528 BFG \u80fd\u770b\u5230\u7684\u90a3\u4e9b\u5927\u6587\u4ef6\uff0c\u76f4\u63a5\u7528 git log \u662f\u770b\u4e0d\u5230\u7684\uff0c\u90fd\u662f child \u76ee\u5f55\u4ee5\u5916\u7684\u5185\u5bb9\u3002child \u7684 git log \u662f\u5e72\u51c0\u7684\u3002\u4f46\u90a3\u4e9b\u5c5e\u4e8e parent \u7684\u8bb0\u5fc6\u5e94\u8be5\u8fd8\u4fdd\u7559\u5728\u67d0\u5904\uff0c\u600e\u4e48\u67e5\u770b\u5462\uff1f<\/p>\n<\/li>\n<\/ul><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4740898\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : blakejia <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             git submodule?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4740899\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : JCZ2MkKb5S8ZX9pq <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @blakejia \u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u62c6\u5206\u7684\u95ee\u9898\u4e86\uff0c\u662f\u6574\u7406\u65e2\u6709\u7684 git \u5386\u53f2\u8bb0\u5f55\u7684\u95ee\u9898\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4740900\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : favourstreet <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982\u679c\u4e3b\u4ee5\u4e3a\u4e0d\u8be5\u5b58\u5728\u7684\u6587\u4ef6\u5b9e\u9645\u4e0a\u5374\u662f\u53ef\u8fbe\u7684\uff0cgit \u8bf4\u4ec0\u4e48\u4e5f\u4e0d\u4f1a\u66ff\u4f60\u5220\u9664\u3002\u5982\u679c\u662f\u4e0d\u53ef\u8fbe\u7684\uff08 unreachable, dangling \uff09\uff0cgit \u4e0d\u4f1a\u81ea\u52a8\u5220\u9664\u8fd8\u672a\u8fc7\u4e00\u4e2a\u6708\u671f\u9650\u548c\u5df2\u7ecf\u6253\u5305\u8fdb pack \u7684 object\uff0c\u6240\u4ee5\uff0cgit reflog expire &#8211;expire=now &#8211;all \uff1b git gc &#8211;prune=now \uff1b git repack -a -d \u6765\u4e00\u5957                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4740901\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : JCZ2MkKb5S8ZX9pq <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @favourstreet \u5e94\u8be5\u662f\u8fdc\u8d85\u4e00\u4e2a\u6708\u4e86\uff0c\u8981\u4e0d\u662f\u7528\u4e86 BFG\uff0c\u6211\u90fd\u4e0d\u77e5\u9053\u4ee5\u524d\u7adf\u7136\u8fd8\u628a pdf \u548c psd \u4e5f commit \u4e86\u3002<\/p>\n<p>\u73b0\u5728\u4ece git log \u6216\u8005\u5404\u4e2a gui \u770b\uff0c\u90fd\u53ea\u80fd\u770b\u5230 filter \u7684\u7ed3\u679c\uff0c\u4e5f\u5c31\u662f\u5305\u542b\u6211\u76ee\u524d\u76ee\u5f55\u7684\u4e00\u4e9b commit \u3002<br \/>\u8bf7\u95ee\u5177\u4f53\u6211\u600e\u4e48\u80fd\u770b\u5230\u5176\u4ed6\u7684\u5185\u5bb9\u5462\uff1f\u6211 git \u5c31\u7528\u4e9b\u57fa\u7840\u529f\u80fd\uff0c\u4e0d\u592a\u719f\u6089\uff0c\u8bf7\u8d50\u6559\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4740902\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : codehz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             (\u8981\u4e0d\u4f60\u53bb.git\/objects \u91cc\u627e\u627e\u5927\u6587\u4ef6\uff1f\u7136\u540e git cat-file \u7684\u65b9\u5f0f\u770b\u770b\u662f\u5565\u5185\u5bb9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4740903\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : favourstreet <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @JCZ2MkKb5S8ZX9pq \u6211\u53ea\u80fd\u8bf4\u4ece\u4e3b\u7684\u63aa\u8f9e\u6765\u770b BFG \u5e2e\u4e3b\u770b\u5230\u4e86\u6587\u4ef6\u540d\uff0c\u8fd9\u610f\u5473\u7740\u90a3\u4e9b\u6587\u4ef6\u4ecd\u5728 git \u7ba1\u7406\u4e4b\u4e0b\uff0c\u4e3b\u6700\u597d\u68c0\u67e5\u4e00\u4e0b\u5f53\u521d subdirectory-filter \u662f\u5426\u6f0f\u4e86\u4ec0\u4e48\uff0c\u6bd4\u5982\u6f0f\u4e86 branch \u6216 tag \u4e4b\u7c7b\u7684 refs                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4740904\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SoloCompany <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7528\u4e86 BFG \u4e4b\u540e, BFG \u7684\u6e90\u6587\u4ef6\u4e5f\u9700\u8981\u4f7f\u7528 filter-branch \u5220\u6389\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4740905\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : JCZ2MkKb5S8ZX9pq <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @codehz <\/p>\n<p>\u7684\u786e\u5927\u6587\u4ef6\u5c31\u662f objects \u91cc\uff0c\u6211\u4e0d\u77e5\u9053\u600e\u4e48\u770b\u5b83\u5230\u5e95\u662f\u5565\uff0c\u539f\u672c\u662f\u4e00\u6574\u4e2a 200M \u7684\u3002\u6211\u53bb\u641c\u4e0b\u4f60\u8bf4\u7684\u8fd9\u4e2a\u547d\u4ee4\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4740906\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : newdongyuwei <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u63a8\u8350\u8bd5\u8bd5 git-filter-repo: https:\/\/github.com\/newren\/git-filter-repo                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>git \u5206\u79bb\u5b50\u6587\u4ef6\u5939\u5bfc\u81f4\u7684\u95ee\u9898 \u8cc7&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/233469"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=233469"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/233469\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=233469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=233469"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=233469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}