Update a development team with rewritten Git repo history, removing big files

后端 未结 4 1234
盖世英雄少女心
盖世英雄少女心 2020-12-01 05:29

I have a git repo with some very large binaries in it. I no longer need them, and I don\'t care about being able to checkout the files from earlier commits. So, to reduce th

4条回答
  •  日久生厌
    2020-12-01 06:01

    Your solution is not complete. You should include --tag-name-filter cat as an argument to filter branch so that the tags that contain the large files are changed as well. You should also modify all refs instead of just HEAD since the commit could be in multiple branches.

    Here is some better code:

    git filter-branch --index-filter 'git rm --cached --ignore-unmatch big_1.zip big_2.zip etc.zip' --tag-name-filter cat -- --all
    

    Github has a good guide: https://help.github.com/articles/remove-sensitive-data

提交回复
热议问题