Python Git Submodules & Large File Storage (Git LFS)
Git Submodules allow keeping another Git repository as a subdirectory of your main project while tracking specific commit SHAs. Git LFS (Large File Storage) replaces heavy binary assets (audio, videos, 3D models, AI model weights) with lightweight text pointers in Git, storing actual payloads on dedicated object storage.
"Submodules are like embedding a live satellite office branch within your headquarters; Git LFS is like putting heavy grand pianos in a warehouse and keeping only the claim ticket receipts in your pocket."
Deep Dive: How It Works
Submodule Tracking: Main repo tracks only the 40-character commit SHA of the nested child repository in .gitmodules.
Cloning Submodules: git clone --recurse-submodules automatically initializes and fetches all nested dependencies.
Git LFS Pointers: Replaces multi-MB binary files with ~130-byte text pointer files containing SHA-256 hashes.
Syntax Blueprint
git submodule add https://github.com/org/library.git libs/lib git lfs install git lfs track "*.psd"
Add nested submodule repository and track heavy binary patterns with Git LFS.
Core Rules to Remember



Common Beginner Traps & How to Fix Them
Cloning a repository with submodules and finding empty subdirectories.Why it happens: Standard git clone does not fetch submodules automatically.
How to fix: Run git submodule update --init --recursive.
Live Interactive Example
Hit Run Code to see it liveYour Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Configure LFS Model Tracking
Write "*.weights filter=lfs diff=lfs merge=lfs -text" to .gitattributes.
Stage and commit with message "chore: track model weights with LFS".
Finished reading and practicing?
Mark this lesson as completed to update your course progress.