git-lfs-fetch man page

git-lfs-fetch — Download all Git LFS files for a given ref

Synopsis

git lfs fetch [options] [remote [ref...]]

Description

Download Git LFS objects at the given refs from the specified remote. See Default Remote and Default Refs for what happens if you don´t specify.

This does not update the working copy.

Options

-I paths --include=paths

Specify lfs.fetchinclude just for this invocation; see Include and Exclude

-X paths --exclude=paths

Specify lfs.fetchexclude just for this invocation; see Include and Exclude

--recent

Download objects referenced by recent branches & commits in addition to those that would otherwise be downloaded. See Recent Changes

--all

Download all objects referenced by any commit that is reachable; this is primarily for backup / migration purposes. Cannot be combined with --recent or --include/--exclude. Ignores any globally configured include and exclude paths to ensure that all objects are downloaded.

--prune -p

Prune old and unreferenced objects after fetching, equivalent to running git lfs prune afterwards. See git-lfs-prune(1) for more details.

Include and Exclude

You can configure Git LFS to only fetch objects to satisfy references in certain paths of the repo, and/or to exclude certain paths of the repo, to reduce the time you spend downloading things you do not use.

In gitconfig, set lfs.fetchinclude and lfs.fetchexclude to comma-separated lists of paths to include/exclude in the fetch. Only paths which are matched by fetchinclude and not matched by fetchexclude will have objects fetched for them.

Examples

  • git config lfs.fetchinclude "textures,images/foo*"

    This will only fetch objects referenced in paths in the textures folder, and files called foo* in the images folder

  • git config lfs.fetchinclude "*.jpg,*.png,*.tga"

    Only fetch JPG/PNG/TGA files, wherever they are in the repository

  • git config lfs.fetchexclude "media/reallybigfiles"

    Don´t fetch any LFS objects referenced in the folder media/reallybigfiles, but fetch everything else

  • git config lfs.fetchinclude "media"
    git config lfs.fetchexclude "media/excessive"

    Only fetch LFS objects in the ´media´ folder, but exclude those in one of its subfolders.

Default Remote

Without arguments, fetch downloads from the default remote. The default remote is the same as for git fetch, i.e. based on the remote branch you´re tracking first, or origin otherwise.

Default Refs

If no refs are given as arguments, the currently checked out ref is used. In addition, if enabled, recently changed refs and commits are also included. See Recent Changes for details.

Recent Changes

If the --recent option is specified, or if the gitconfig option lfs.fetchrecentalways is true, then after the current ref (or those in the arguments) is fetched, we also search for ´recent´ changes to fetch objects for, so that it´s more convenient to checkout or diff those commits without incurring further downloads.

What changes are considered ´recent´ is based on a number of gitconfig options:

Examples

See Also

git-lfs-checkout(1), git-lfs-pull(1), git-lfs-prune(1).

Part of the git-lfs(1) suite.

Referenced By

git-lfs(1), git-lfs-checkout(1), git-lfs-config(5), git-lfs-prune(1), git-lfs-pull(1).

April 2019