World map

 

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

bash
git clone --depth 1 https://github.com/you/big-game.git
One command: git clone --depth 1 with the game repo's address.

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

bash
git clone --filter=blob:none https://github.com/you/big-game.git
One command: git clone --filter=blob:none with the game repo's address.

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

bash
git lfs install
git lfs track "*.psd"
cat .gitattributes
*.psd filter=lfs diff=lfs merge=lfs -text
git lfs install, then git lfs track star dot psd. The .gitattributes file now says *.psd filter=lfs diff=lfs merge=lfs -text.

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.