I am trying to remove some large files from my git
repository.
After a fair amount of browsing I have come across the following solution,
git_delete_file() {
git filter-branch -f --index-filter "git rm -r --cached --ignore-unmatch $1" --prune-empty
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --aggressive --prune=now
}
git_file_space() {
git rev-list --all --objects |
git cat-file --batch-check='%(objectname) %(objecttype) %(objectsize) %(rest)' |
grep blob |
sort -k3nr |
head -n 20
}
However, when I run git_delete_file large/file/path
and then git_file_space
the files are persisting. I have not tried to download git-filter-repo
but I am considering it a last resort.
Regards Jordan