从GitHub删除的文件使Repo更大

时间:2016-01-26 19:22:48

标签: git github

使用Mac 未安装BFG。想先了解Git Filter-Branch

问题:我已经能够从我的Git Repos中删除一些文件(其他文件似乎并不想删除),但是,每次我获取文件删除回购增加时尺寸。这不是我想要做的。我觉得Github在某处保存了一些东西,但我不确定如何定位它。

我想做什么:删除文件和历史记录(缩小回购邮件大小)。

我已经按照此处的步骤开始清理文件并以Push the Repository结束。我一直在定位随机文件,以便更好地了解如何删除文件。我一直在当地的仓库工作,然后在GitHub上推进遥控器。

  1. $ git filter-branch --tag-name-filter cat --index-filter' git rm -r --cached --ignore-unmatch RandomFileName' --prune-empty -f - --all
  2. 我认为这似乎是在正确的轨道上

    1. rm -rf .git / refs / original / 这似乎没有做任何事情

    2. git reflog expire --expire = now --all 这似乎没有做任何事情

    3. git gc --prune = now

    4. 5.git gc --aggressive --prune = now

      1. git push origin --force --all
      2. 7.git push origin --force --tags(未在下面的代码中显示)

        Patricks-Air:github-gem PatCosta$ git filter-branch --tag-name-filter cat --index-filter 'git rm -r --cached --ignore-unmatch manifest' --prune-empty -f -- --all
        Rewrite a34114662b3f3856a9683dc80d0e8f8567ec28c5 (579/579)
        WARNING: Ref 'refs/heads/master' is unchanged
        WARNING: Ref 'refs/remotes/origin/master' is unchanged
        WARNING: Ref 'refs/remotes/origin/fallthrough' is unchanged
        WARNING: Ref 'refs/remotes/origin/gist' is unchanged
        WARNING: Ref 'refs/remotes/origin/keithpitt-ruby-1.9-update' is unchanged
        WARNING: Ref 'refs/remotes/origin/master' is unchanged
        WARNING: Ref 'refs/remotes/origin/organizations' is unchanged
        WARNING: Ref 'refs/remotes/origin/upload' is unchanged
        WARNING: Ref 'refs/tags/REL-0.4.2' is unchanged
        WARNING: Ref 'refs/tags/REL-0.4.3' is unchanged
        WARNING: Ref 'refs/tags/REL-0.4.4' is unchanged
        WARNING: Ref 'refs/tags/v0.1.3' is unchanged
        WARNING: Ref 'refs/tags/v0.3.10' is unchanged
        WARNING: Ref 'refs/tags/v0.3.9' is unchanged
        WARNING: Ref 'refs/tags/v0.4.6' is unchanged
        WARNING: Ref 'refs/tags/v0.5.0' is unchanged
        WARNING: Ref 'refs/tags/v0.6.0' is unchanged
        WARNING: Ref 'refs/tags/v0.6.1' is unchanged
        WARNING: Ref 'refs/tags/v0.6.2' is unchanged
        WARNING: Ref 'refs/tags/v0.7.0' is unchanged
        WARNING: Ref 'refs/tags/v0.7.1' is unchanged
        WARNING: Ref 'refs/tags/v0.7.2' is unchanged
        REL-0.4.2 -> REL-0.4.2 (135ecb3160aa8d40f20ff5c2ad6da5ffca17048f -> 135ecb3160aa8d40f20ff5c2ad6da5ffca17048f)
        REL-0.4.3 -> REL-0.4.3 (abea096a9b376d52d9f39ff0d5623b53f879864d -> abea096a9b376d52d9f39ff0d5623b53f879864d)
        REL-0.4.4 -> REL-0.4.4 (0e572e1a5e6daaff68a42500015684b078b50545 -> 0e572e1a5e6daaff68a42500015684b078b50545)
        v0.1.3 -> v0.1.3 (bc3b1ecc90460df1656c22db8190ff1e4d2f119b -> bc3b1ecc90460df1656c22db8190ff1e4d2f119b)
        v0.3.10 -> v0.3.10 (d372fd6e803d3ba0cdb39f90a6a5a23a721b6673 -> d372fd6e803d3ba0cdb39f90a6a5a23a721b6673)
        v0.3.9 -> v0.3.9 (ad3a27c8f693d4126fb689366f5d92d241aa77b6 -> ad3a27c8f693d4126fb689366f5d92d241aa77b6)
        v0.4.6 -> v0.4.6 (cff9e1238da21e310f5387117f69e2e6a147183d -> cff9e1238da21e310f5387117f69e2e6a147183d)
        v0.5.0 -> v0.5.0 (582a27923455d89e7cfcf1779ff1f371bd585911 -> 582a27923455d89e7cfcf1779ff1f371bd585911)
        v0.6.0 -> v0.6.0 (a1eb11c388eb37c4ad5f2b66d3a8a1653409b248 -> a1eb11c388eb37c4ad5f2b66d3a8a1653409b248)
        v0.6.1 -> v0.6.1 (7b02b0ea6859da0dbc07e2218ec295b4ef34dff5 -> 7b02b0ea6859da0dbc07e2218ec295b4ef34dff5)
        v0.6.2 -> v0.6.2 (9002b9262ea79c50b1421ff805db238471e14a2f -> 9002b9262ea79c50b1421ff805db238471e14a2f)
        v0.7.0 -> v0.7.0 (b9ac57b884536a50caa91123756f09df49632545 -> b9ac57b884536a50caa91123756f09df49632545)
        v0.7.1 -> v0.7.1 (cf2a1493bd84a8257570e18bea4bc68907083534 -> cf2a1493bd84a8257570e18bea4bc68907083534)
        v0.7.2 -> v0.7.2 (6f1a10f16d311b6db8ce4f98f633d276830ce952 -> 6f1a10f16d311b6db8ce4f98f633d276830ce952)
        Patricks-Air:github-gem PatCosta$ rm -rf .git/refs/original/
        Patricks-Air:github-gem PatCosta$ git reflog expire --expire=now --all
        Patricks-Air:github-gem PatCosta$ git gc --prune=now
        Counting objects: 2432, done.
        Delta compression using up to 4 threads.
        Compressing objects: 100% (934/934), done.
        Writing objects: 100% (2432/2432), done.
        Total 2432 (delta 1474), reused 2432 (delta 1474)
        Patricks-Air:github-gem PatCosta$ git gc --aggressive --prune=now
        Counting objects: 2432, done.
        Delta compression using up to 4 threads.
        Compressing objects: 100% (2408/2408), done.
        Writing objects: 100% (2432/2432), done.
        Total 2432 (delta 1474), reused 958 (delta 0)
        Patricks-Air:github-gem PatCosta$ git push origin --force --all
        Everything up-to-date
        Patricks-Air:github-gem PatCosta$ git gc --prune=now --aggressive
        Counting objects: 2432, done.
        Delta compression using up to 4 threads.
        Compressing objects: 100% (2408/2408), done.
        Writing objects: 100% (2432/2432), done.
        Total 2432 (delta 1474), reused 958 (delta 0)
        Patricks-Air:github-gem PatCosta$  git push origin master --force
        

        来源网站
        http://stevelorek.com/how-to-shrink-a-git-repository.html
        https://help.github.com/articles/remove-sensitive-data/

0 个答案:

没有答案