Git was designed for source code (plain text files). When you commit large binary files—such as 4K video clips, 3D graphics assets, raw datasets, or 500MB machine learning models—standard Git bloats rapidly because it stores full copies of every version in .git/objects/. Furthermore, GitHub rejects any file over 100MB. The solution is Git LFS (Large File Storage).
Git LFS replaces large files inside your Git repository with lightweight text pointer files (about 130 bytes). The actual heavy binary data is uploaded to dedicated cloud media storage (e.g. GitHub LFS storage or AWS S3):
# What Git actually stores inside your repo instead of the 200MB video:
version https://git-lfs.github.com/spec/v1
oid sha256:4d7a92b184e03d...
size 209715200
When you clone or checkout, Git LFS downloads only the specific binary assets needed for your currently checked-out commit, keeping your repository lightweight and blazing fast!
# Step 1: Install Git LFS extensions on your system
$ git lfs install
Updated Git hooks.
Git LFS initialized.
# Step 2: Configure Git LFS to track specific file extensions
$ git lfs track "*.psd"
$ git lfs track "*.mp4"
$ git lfs track "*.onnx"
$ git lfs track "assets/models/**"
# Step 3: Git LFS records these rules in a .gitattributes file. Commit it!
$ git add .gitattributes
$ git commit -m "chore: configure Git LFS for video and model assets"
Once configured, you use standard Git commands! You add, commit, and push normally:
$ git add video.mp4
$ git commit -m "feat: add promotional onboarding video"
$ git push origin main
Uploading LFS objects: 100% (1/1), 185 MB | 12 MB/s, done.
# Modern Git LFS downloads assets automatically during clone:
$ git clone https://github.com/user/heavy-project.git
# To pull LFS binaries manually if missing:
$ git lfs pull
Strengthen your version control mastery by studying these connected classes:
Decide when to ignore binary files vs when to track them via Git LFS pointers.
Understand why large binary files cause standard Git repositories to bloat.
Learn how Git LFS downloads binary assets on demand from remote media servers.
Resolve GitHub bandwidth limits and handle large files committed accidentally.
Advance your software engineering skills with the next topic in our synchronized curriculum.
Continue to 30+ Lab Practice Scenarios → Previous: ← Git Branching Strategies | Full Syllabus