Git LFS

Table of Contents

Overview

git lfs install
git lfs track "design.psd"
git lfs track "*.mov"
design.psd filter=lfs diff=lfs merge=lfs -text
*.mov filter=lfs diff=lfs merge=lfs -text

Topics

Using git lfs pull

git lfs pull downloads lfs files as batch, but works on current local branch. But when executing git pull to update local branch, LFS automatically missing files separately. This is really slow.

LFS works on Git Attributes, which provides a filtering interface by smudge and clean. To prevent git pull from downloading lfs files seprately, make them skip downloading.

$ git lfs install configures lfs like this:

[filter "lfs"]
    clean = git-lfs clean -- %f
    smudge = git-lfs smudge -- %f
    process = git-lfs filter-process
    required = true

To make smudge and process skip downloading:

smudge = git-lfs smudge --skip -- %f
process = git-lfs filter-process --skip

You can manually edit the config or use --skip-smudge flag when git lfs install, like $ git lfs install --skip-smudge.