Git Cheat Sheet · Submodules and LFS

Track large files with Git LFS

git lfs track <pattern>

Git LFS (Large File Storage) stores large files, such as images, videos or design files, on a separate server. The repository keeps only a small pointer. History stays light and clones stay fast.

What it does

Stores large files outside the history, which keeps only a pointer.

A use case

Your repository contains .psd mockups of several hundred MB.

Warning: Git LFS must be installed on the machine.

On the command line

git lfs install
Enables LFS for your account, once per machine.
git lfs track "*.psd"
Tracks all .psd files with LFS (adds the rule to .gitattributes).
git add .gitattributes
The rule must be committed with the files.
git lfs ls-files
Lists files managed by LFS.
git lfs migrate import --include="*.psd"
Converts files already committed (rewrites history).

In Merathon

  1. "LFS" section of the left panel: the "+" adds a pattern (*.psd).
  2. Or right-click an untracked file → "Track *.ext files with Git LFS".
  3. Commit the modified .gitattributes along with the files.

Frequently asked questions

Why does git lfs track have no effect on my files?

It only applies to files added afterwards. For files already committed, you need git lfs migrate.

Do GitHub and GitLab support Git LFS?

Yes, with a storage and bandwidth quota depending on the plan.

See also