Lesson 44 +20 XP

Git LFS

Git LFS

Git LFS (Large File Storage) is an extension for handling big files that would bloat a normal repository.

The problem with big files

Git stores every version of every file. Large binaries like videos, images, and design files make repositories huge and slow to clone.

What LFS does

Instead of storing the big file in the repository, LFS stores a small pointer in Git and the actual file on a separate server.

Install LFS

git lfs install

Track file types

git lfs track "*.psd"
git lfs track "*.mp4"

This updates your .gitattributes automatically.

Use Git normally after that

Once a type is tracked, you git add and git commit as usual. LFS handles the big files behind the scenes.

Check what is tracked

git lfs ls-files

The trade off

LFS needs a server that supports it. GitHub supports LFS, but it has storage and bandwidth limits on free accounts.

TL;DR

  • Git LFS stores large files outside the repository.
  • Install with git lfs install.
  • Track types with git lfs track "*.psd".
  • Big files become pointers; the real files live on an LFS server.