Git LFS

Git LFS

Tags
Git
Published
January 11, 2024
Author

Motivation

Sometimes we don’t want to download all LFS files all at one (with git clone), so we can use skip-smudge to create pointers for all LFS files first, and then download only what we really need.
Β 

Steps

  1. install skip-smudge function for git lfs
    1. git lfs install --skip-smudge
  1. clone the repo with only pointers
    1. # linux GIT_LFS_SKIP_SMUDGE=1 git clone [repo.url] # windows set GIT_LFS_SKIP_SMUDGE=1; git clone [repo.url] cd [repo]
  1. pull down selected file
    1. git lfs pull --include "file.name"
Β 
Done πŸ‘
If you want to transfer a downloaded LFS file back into a pointer
git lfs pointer --file="filename" > filename.pt mv filename.pt filename