TIL: Migrate an already-committed large file to Git LFS
GitHub warns (and blocks at 100 MB) if you push large binaries via regular git. If a file slipped in already, migrate it without rewriting history.
Steps
# 1. Install and init
brew install git-lfs
git lfs install # writes hooks to ~/.gitconfig
# 2. Track the file type in the repo
git lfs track "*.mp4" # creates/updates .gitattributes
# 3. Remove from regular git index, re-add under LFS
git rm --cached path/to/file.mp4
git add path/to/file.mp4 .gitattributes
# 4. Commit and push — LFS uploads the binary separately
git commit -m "chore: migrate file.mp4 to Git LFS"
git push
The repo stores a small pointer file; the binary lives in LFS storage. No history rewrite needed as long as you catch it before others pull the large commit.