ref: https://www.czettner.com/2015/07/16/deleting-big-files-from-git-history.html
git filter-branch --force --index-filter "git rm --cached --ignore-unmatch dev/database.sql" --prune-empty --tag-name-filter cat -- --all
git reflog expire --expire=now --all
git gc --prune=now
git push origin --force --all
git push origin --force --tags
rm -rf .git/refs/original/
git fetch
git reset origin/master --hard
# https://stackoverflow.com/questions/5613345/how-to-shrink-the-git-folder
git repack -a -d --depth=250 --window=250
Example:
Given the large file is understand-tooling/combined-metadata.json
:
git filter-branch --force --index-filter "git rm --cached --ignore-unmatch understand-tooling/combined-metadata.json" --prune-empty --tag-name-filter cat -- --all
git reflog expire --expire=now --all
git gc --prune=now
git push origin --force --all
git push origin --force --tags
rm -rf .git/refs/original/