World map

 

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

Two commits in the repository. The newest, Add trip page, glows and wobbles. It holds trip.html and a huge video.mp4.

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 prints rm video.mp4. Then git status -s shows D video.mp4 in the box, and video.mp4 as untracked. Terminal output: $ git rm --cached video.mp4 rm 'video.mp4' $ git status -s D video.mp4 ?? video.mp4

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.

Working folder
  • Empty
Staging area
  • Empty
Repository
  • 4 save points
  • Add trip page
  • Add style
  • Add day 1 page

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.