BM: Baca dalam Bahasa Melayu
World 10: Deep Git
Big repos: shallow, sparse, LFS
You will learn: how to get only the part of a huge repo that you need.
The problem
A game repo is huge: 15 years of history and giant pictures. You only need to fix one typo today. Must you download it all?
Pick one answer.
Watch
A shallow clone: A clone with only the newest commits, not the whole history. takes only the newest commits. --depth 1 means just the last one. Quick for a one-off fix or a test robot.
Predict
You made a shallow clone with --depth 1. You run git log --oneline. What do you see?
Pick one answer.
Watch
A partial clone: A clone with every commit, but file contents only when you need them. gets every commit, but file contents only when needed. blob:none means: no blobs up front. Git fetches them as you check files out.
Try it
sparse-checkout: Shows only some folders of a repo in your working folder. shows only some folders on your desk. Build the command to see just the docs folder.
Tap the pieces in the right order.
Watch
Git LFS: An add-on that keeps big files outside normal Git history. Git stores a small pointer instead. is an add-on for big files. Git keeps a tiny pointer. The real file lives on an LFS server.
Check
Which tool fits each job?
Drag a card into a box. Or tap the card, then tap the box.
You did it!
You can now work with huge repos without downloading everything.
Go deeper (optional)
git fetch --unshallow turns a shallow clone into a full one. git clone --sparse starts with only the top folder; then git sparse-checkout set. git sparse-checkout disable shows everything again. Git LFS is an add-on. Missing? Get it from git-lfs.com. Hosting sites limit LFS storage, so check your plan.
Bahasa Melayu
Repo sebuah permainan sangat besar: sejarah 15 tahun dan gambar gergasi. Hari ini anda cuma perlu baiki satu salah taip. Perlukah muat turun semuanya?
Shallow clone (clone cetek) ambil commit terbaru sahaja. --depth 1 maksudnya yang terakhir sahaja. Pantas untuk pembaikan sekali atau robot ujian.
Anda buat shallow clone dengan --depth 1. Anda jalankan git log --oneline. Apa yang anda nampak?
Partial clone (clone separa) ambil setiap commit. Isi fail diambil bila perlu sahaja. blob:none maksudnya tiada blob pada awalnya. Git ambil blob bila anda checkout fail.
sparse-checkout papar sebahagian folder sahaja atas meja anda. Bina arahan untuk tengok folder docs sahaja.
Git LFS ialah tambahan untuk fail besar. Git simpan penunjuk kecil sahaja. Fail sebenar tinggal di pelayan LFS.
Alat mana sesuai untuk setiap kerja?
Kini anda boleh kerja dengan repo gergasi tanpa muat turun semuanya.
You finished this before. Practice is always welcome!
Official docs: git clone (--depth, --filter) · git sparse-checkout · Partial clone · 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?