Setup
git lfs install
Set up LFS filters for your user
Run once per machine; inside a repo it also adds the pre-push
hook.
git lfs install --local
Set up LFS in this repo only
git lfs install --skip-smudge
Clone with pointers, no download
Handy for CI that does not need the big files; fetch later
with git lfs pull.
git lfs version
Show the installed version
git lfs env
Show endpoint, paths and config
git lfs update
Reinstall the repo hooks
Tracking
git lfs track "<pattern>"
Track files matching a pattern
Quote the pattern so the shell does not expand it.
git lfs track
List tracked patterns
git lfs untrack "<pattern>"
Stop tracking a pattern
Existing commits keep their pointers; use migrate export to
convert them back.
git lfs track --filename <file>
Track one exact filename
git lfs track --dry-run "<pattern>"
Preview without changing anything
.gitattributes entry
*.psd filter=lfs diff=lfs merge=lfs -text
Transfer
git lfs pull
Fetch objects and update files
git lfs fetch
Download objects, keep files as is
git lfs fetch --all
Download every referenced object
git lfs fetch --recent
Also fetch recent branches
git lfs pull -I "<paths>"
Only fetch matching paths
-X excludes paths; both take comma-separated globs.
git lfs checkout
Write fetched content into files
Downloads nothing; uses the local LFS store.
git lfs push origin <branch>
Upload objects for a branch
A normal git push already does this through the pre-push hook.
git lfs push --all origin
Upload all local history
Use after switching or mirroring to a new remote.
git lfs push --dry-run origin
Show what would be uploaded
Migrate
git lfs migrate import
--include="<patterns>"
Convert history to LFS
Rewrites commits; force-push needed afterwards.
git lfs migrate import --include="<patterns>"
--everything
Convert all refs
git lfs migrate import --above=<size>
Convert files over a size
Size such as 1mb or 500kb.
git lfs migrate import --no-rewrite <files>
Convert without rewriting history
Adds one new commit; also writes .gitattributes.
git lfs migrate export
--include="<patterns>"
Convert LFS files back to Git
git lfs migrate import --fixup
Repair files wrongly committed