gitmyhub

git-lfs

Go ★ 14k updated 8d ago

Git extension for versioning large files

Git LFS is a Git extension that stores large files like images and videos on a separate server instead of inside your repository, keeping clone times fast and history clean.

Gosetup: easycomplexity 2/5

Git LFS (Large File Storage) is an extension to Git that helps manage large files like images, videos, audio files, and design assets without bloating the repository's history. Git tracks every version of every file, which works well for source code but becomes unwieldy for large binary files that change frequently. Git LFS solves this by replacing those files in the repository with small pointer files, while the actual file contents are stored separately on a dedicated LFS server. When you clone or check out a repository, Git LFS downloads only the large file versions you need rather than the full history of every binary.

Setting it up requires installing the extension and running git lfs install once per machine, then telling Git LFS which files to track using patterns like *.psd or *.mp4. After that, your normal Git workflow continues unchanged: you add, commit, and push as usual, and Git LFS handles the large files automatically in the background. The .gitattributes file stores the tracking rules and should be committed alongside the rest of your code so everyone working on the project benefits from the same configuration.

For repositories that already have large files in their history, a migration command called git lfs migrate can retroactively move existing large files into LFS storage. This rewrites the repository's commit history, which changes all the Git object IDs, so it should be coordinated carefully across everyone working on the project.

Git LFS is available for Linux, macOS, Windows, and FreeBSD. On Windows it is bundled with Git for Windows. It can also be installed via Homebrew on macOS or from pre-built binary packages. The extension is already supported by GitHub, GitLab, Bitbucket, and many other Git hosting services. The project is written in Go and released under the MIT license.

Where it fits