How to manage large files in Git with LFS

· Category: Git

Short answer

Git LFS replaces large files with text pointers in the repository, storing actual file contents on a remote server.

Steps

  1. Install Git LFS:
git lfs install
  1. Track file types:
git lfs track "*.psd"
git lfs track "*.zip"
  1. Commit the .gitattributes file and your large files normally.
  2. Push; LFS uploads the file content separately.

Tips

  • Check LFS status with git lfs ls-files.
  • Migrate existing large files with git lfs migrate.
  • Be mindful of LFS bandwidth and storage quotas on hosted platforms.

Common issues

  • Missing LFS objects: run git lfs fetch or git lfs pull.
  • Without LFS installed, users see only pointer files, not the actual content.