Removing unwanted files from history including all refs with filter-branch

南笙酒味 提交于 2019-12-03 19:39:16

I ended up using the BFG Repo Cleaner on a bare cloned repository (git clone --mirror repo-url). It goes through every branch/tag, leaving each working and it is even much faster than filter-branch. Hope this helps other people having similar issues.

Here is my wrapper script:

#!/bin/bash
#usage: ./remove_files.sh file_list.txt bare-repo-dir
while read file_hash file_to_remove
do
    echo "Removing "$file_to_remove;
    lastFile=`echo $file_to_remove | awk -F/ '{print $NF}'`;
    java -jar bfg.jar --delete-files $lastFile $2;
done < $1

cd $2;
git gc --prune=now --aggressive;
cd ..;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!