my-git

Git LFS

English 中文

Git LFS is used to manage large files.

Git itself is well-suited for managing text and small files. If large binary files frequently enter regular Git history, they will make the repository increasingly slow and raise the costs of clone, fetch, and diff operations.

Suitable Scenarios

Content Unsuitable for Committing to Git

These contents should ideally be placed in object storage, artifact repositories, or CI caches.

Basic Usage

Enable after installation:

git lfs install

Track a specific type of file:

git lfs track "*.psd"
git add .gitattributes
git add design.psd
git commit -m "chore(lfs): track design assets"

Team Rules

What to do if large files were already mistakenly committed

History needs to be cleaned up, typically using git filter-repo or BFG Repo-Cleaner.

Cleaning up history affects collaborators; the team must be notified in advance.

Further Reading