Read Anthropic’s case study about Graphite Reviewer

How to use git LFS pull

Kenny DuMez
Kenny DuMez
Graphite software engineer


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


Git Large File Storage (LFS) is an extension for Git that allows users to manage large files efficiently. The git lfs pull command is specifically used to download large files tracked by Git LFS from a remote repository to your local machine. This guide provides detailed instructions on how to use git lfs pull, including pulling specific files, all files, and understanding its interaction with standard git pull operations.

Git lfs pull is used after cloning a repository or to update your current repository with changes from a remote that include updates to LFS objects. It ensures that all files tracked by LFS are downloaded and replaced with their actual content, rather than just pointers.

  1. Pull all LFS files after cloning: After cloning a repository with LFS files, you typically need to pull these files into your local clone:

    Terminal
    git lfs pull

    This command downloads all LFS-tracked files that are missing or have been updated on the remote.

  2. Pull LFS files from a specific remote: If you are working with multiple remotes, specify which remote to pull from:

    Terminal
    git lfs pull <remote_name>

Sometimes, you may not need all LFS files, especially in large repositories. To pull specific files:

  1. Pull a single file: To pull a specific LFS file, you can use the git lfs pull command with a path filter:

    Terminal
    git lfs pull --include="path/to/file"
  2. Pull multiple specific files: You can include multiple files by using multiple --include flags or by using wildcard characters:

    Terminal
    git lfs pull --include="path/to/file1" --include="path/to/file2"
  1. Recursive pull: In cases where your repository has nested submodules that also use Git LFS, you might want to recursively pull LFS objects for all submodules:

    Terminal
    git lfs pull --recursive
  2. Exclude certain files: If you want to exclude certain files while pulling, use the --exclude option:

    Terminal
    git lfs pull --exclude="path/to/unwanted/file"
  1. Pulling with LFS during a git pull: When you run a standard git pull, Git LFS files are automatically fetched if the Git LFS extension is correctly installed and initialized. However, this only fetches the latest pointers, not the actual file content. A subsequent git lfs pull is necessary to download the actual file contents.

  2. Pulling without LFS: If you need to perform a git pull without fetching LFS objects (for example, to save bandwidth or time), you can temporarily disable LFS:

    Terminal
    GIT_LFS_SKIP_SMUDGE=1 git pull

    Later, you can run git lfs pull to download the LFS objects.

For further reading see the official Git LFS documentation.

Git inspired
Graphite's CLI and VS Code extension make working with Git effortless.
Learn more

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2