Interview Prep/Git & GitHub/Repository Health, Size and Performance

You deleted a 600 MB file with `git rm` and committed, but the repo is still huge.

BeginnerTroubleshootingRepository Health, Size and Performance
Answer

Likely causes → git rm only removes the file from the next snapshot. Every previous commit still references the blob, so it stays in history, in every clone and on the server.

Diagnose → git log --all --oneline -- path/to/bigfile shows the commits that still contain it.

Fix → Rewrite history to remove it from all commits, then force-push:

git filter-repo --path path/to/bigfile --invert-paths   # run in a fresh clone
git push --force --all && git push --force --tags

All collaborators must re-clone (or hard-reset to the new history), and open PRs need rebasing.

Prevent → Add a pre-commit size check (check-added-large-files in pre-commit) and ignore dumps and build artifacts.

All Git & GitHub questions Roadmap: Git & GitHub

More on Repository Health, Size and Performance