We are trying to shrink our git repository to under 500MB due to deployment issues.
To achieve that, we have created a new branch where we have moved all old images, videos and fonts to AWS S3.
I can easily get the list of files with git diff --name-only --diff-filter=D master -- public/assets/
.
Now, I have tried to run BFG-repo-cleaner 1.14.0 on each file. But I have 400 files and it is taking ages to delete each files separately (still running as I'm writing this).
git diff --name-only --diff-filter=D master -- public/assets/ | xargs -i basename '{}' | xargs -i bfg --delete-files '{}'
Since each file is distinct, I can not really use a glob pattern, as suggested at Delete multiple files from multiple branch using bfg repo cleaner.
I tried to separate each file with a comma but that resulted in BFG-repo-cleaner telling me:
BFG aborting: No refs to update - no dirty commits found??
Is there a way to provide multiple files to BFG-repo-cleaner without a glob pattern?
PS. The command I tried with multiple files is: git diff --name-only --diff-filter=D master -- public/assets/ | xargs -i basename '{}' | sed -z 's/\n/,/g;s/,$/\n/' | xargs -i bfg --delete-files '{}' && git reflog expire --expire=now --all && git gc --prune=now --aggressive
PPS. The bfg
command is on my PATH as a simple bash script with java -jar /tools/BFG-repo-cleaner/bfg-1.14.0.jar "$@"