Git Large File Storage (LFS) is an extension for Git that improves performance when working with large binary files by storing them outside the main repository and keeping lightweight pointers inside Git.
Git LFS replaces large files in your repository with text pointers, while storing the real content remotely. This prevents repository bloat and keeps Git operations fast.
Instead of storing large binaries directly, Git LFS tracks pointer files. When needed, Git LFS downloads the real files from the server automatically.
# Install Git LFS using system package managers
brew install git-lfs
choco install git-lfs
sudo apt-get install git-lfs
# Enable Git LFS for the current user
git lfs install
# Track all MP4 video files using Git LFS
git lfs track "*.mp4"
# Add LFS configuration and large file
git add .gitattributes
git add large-file.mp4
git commit -m "Add large files using Git LFS"
# Push commits and upload large files to LFS server
git push origin main
# List all files currently tracked by Git LFS
git lfs ls-files
# Stop tracking files with Git LFS
git lfs untrack "*.mp4"
# Download large files from the LFS server
git lfs fetch