BM: Baca dalam Bahasa Melayu
World 11: Rescue Center
I committed a huge file
You will learn: how to get a huge file out of a commit before it spreads.
The problem
Your push crawls. Then GitHub refuses it: video.mp4 is too big. Oops! This happens to everyone. Here’s the safe way out.
Try it
GitHub refused the push. So where is the video now?
Pick one answer.
Watch
git rm --cached video.mp4 tells Git to stop tracking it. The video stays on your computer, safe.
Try it
Take the video out of the last commit. Ignore *.mp4 so it can’t sneak back.
- Empty
- Empty
- 4 save points
- Add trip page
- Add style
- Add day 1 page
Hint
Typegit rm --cached video.mp4, then echo "*.mp4" >> .gitignore and git add .gitignore. Last, git commit --amend --no-edit.Predict
New story: the video was smaller, and the push worked. You delete it in a new commit. Is the repo small again?
Pick one answer.
Check
Commit it, or keep it out of Git? Sort each file.
Drag a card into a box. Or tap the card, then tap the box.
You did it!
You can now get a huge file out before it spreads.
Go deeper (optional)
GitHub warns above 50 MiB and blocks files over 100 MiB. Need big files in a repo? Git LFS is an add-on: git lfs track "*.mp4" keeps videos outside normal history. Big file in an older commit, not pushed? git reset --soft origin/main puts all unpushed work back in the box. Remove the file, then commit again.
Bahasa Melayu
Push anda merangkak. Kemudian GitHub tolak: video.mp4 terlalu besar. Alamak! Ini berlaku pada semua orang. Ini cara selamat untuk keluar.
GitHub tolak push itu. Jadi, di mana video itu sekarang?
git rm --cached video.mp4 suruh Git berhenti jejak fail itu. Video kekal selamat dalam komputer anda.
Keluarkan video dari commit (titik simpan) terakhir. Abaikan *.mp4 supaya ia tak menyelinap balik.
git rm --cached video.mp4, kemudian echo "*.mp4" >> .gitignore dan git add .gitignore. Akhir sekali, git commit --amend --no-edit.Cerita baru: video lebih kecil, dan push berjaya. Anda padam dalam commit baru. Adakah repo kecil semula?
Commit, atau jauhkan dari Git? Susun setiap fail.
Kini anda boleh keluarkan fail besar dari commit sebelum ia tersebar.
You finished this before. Practice is always welcome!
Official docs: git rm --cached · About large files on GitHub · About Git Large File Storage
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?