git-lfs
Manage large files in Git repositories
TLDR
Initialize Git LFS
Track files that match a glob
Change the Git LFS endpoint URL (useful if the LFS server is separate from the Git server)
List tracked patterns
List tracked files that have been committed
Push all Git LFS objects to the remote server (useful if errors are encountered)
Fetch all Git LFS objects
Replace pointer files with actual Git LFS objects
SYNOPSIS
git lfs [<options>] <command> [<args>]
PARAMETERS
-h, --help
Show help for the command
-v, --version
Print Git LFS version
--debug
Enable debug logging
install
Install LFS hooks in current Git repo
track <pattern>
Track files matching pattern with LFS
untrack <pattern>
Stop tracking files with LFS
lock [<file>]
Lock file(s) to prevent concurrent edits
unlock [<file>]
Unlock file(s)
push [<remote>]
Push LFS objects to remote
pull [<remote>]
Pull LFS objects from remote
fetch [<remote>]
Fetch LFS objects without checking out
checkout
Update working tree with LFS files
ls-files
List LFS-tracked files
status
Show status of LFS-tracked files
prune
Delete unused LFS objects locally
migrate
Migrate Git history to/from LFS
DESCRIPTION
Git LFS (Large File Storage) is a command-line tool extending Git to handle large files efficiently. It replaces large files in the repository with tiny pointer files containing metadata, while storing actual file contents on a remote LFS server.
Usage begins with git lfs install, which sets up Git hooks for smudge (checkout) and clean (checkin) filters. Track files via git lfs track '*.zip', creating .gitattributes entries. When committing tracked files, Git LFS uploads them to the server; clones download pointers first, fetching content on demand with git lfs pull or hooks.
Supports features like file locking to prevent edit conflicts, pruning unused objects, and migration of existing repos. Requires server-side support (e.g., GitHub, GitLab). Ideal for binaries, media, datasets—keeps Git repos lightweight and fast.
CAVEATS
Requires LFS-compatible server (e.g., GitHub). Does not reduce server storage; files consume space there. Hooks must be installed per repo/clone.
EXAMPLE WORKFLOW
git lfs install
git lfs track '*.psd'
git add .gitattributes large.psd
git commit -m 'Add PSD'
git push
ENVIRONMENT VARS
GIT_LFS_SKIP_SMUDGE=1 (skip file download on checkout).
GIT_LFS_FORCE_SKD_SMUDGE=1 (force download).
HISTORY
Announced by GitHub in 2015; initial release v0.5. Development by GitHub, Atlassian, Basecamp. Now at v3.x, integrated in most Git hosts.
SEE ALSO
git(1), gitattributes(5), git-config(5)


