1GIT-LFS-FETCH(1)                                              GIT-LFS-FETCH(1)
2
3
4

NAME

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

SYNOPSIS

9       git lfs fetch [options] [<remote> [<ref>...]]
10

DESCRIPTION

12       Download Git LFS objects at the given refs from the specified remote.
13       See DEFAULT REMOTE and DEFAULT REFS for what happens if you don’t
14       specify.
15
16       This does not update the working copy.
17

OPTIONS

19       -I <paths>, --include=<paths>
20           Specify lfs.fetchinclude just for this invocation; see INCLUDE AND
21           EXCLUDE.
22
23       -X <paths>, --exclude=<paths>
24           Specify lfs.fetchexclude just for this invocation; see INCLUDE AND
25           EXCLUDE.
26
27       --recent
28           Download objects referenced by recent branches & commits in
29           addition to those that would otherwise be downloaded. See RECENT
30           CHANGES.
31
32       --all
33           Download all objects that are referenced by any commit reachable
34           from the refs provided as arguments. If no refs are provided, then
35           all refs are fetched. This is primarily for backup and migration
36           purposes. Cannot be combined with --recent or --include/--exclude.
37           Ignores any globally configured include and exclude paths to ensure
38           that all objects are downloaded.
39
40       --prune, -p
41           Prune old and unreferenced objects after fetching, equivalent to
42           running git lfs prune afterwards. See git-lfs-prune(1) for more
43           details.
44

INCLUDE AND EXCLUDE

46       You can configure Git LFS to only fetch objects to satisfy references
47       in certain paths of the repo, and/or to exclude certain paths of the
48       repo, to reduce the time you spend downloading things you do not use.
49
50       In your Git configuration or in a .lfsconfig file, you may set either
51       or both of lfs.fetchinclude and lfs.fetchexclude to comma-separated
52       lists of paths. If lfs.fetchinclude is defined, Git LFS objects will
53       only be fetched if their path matches one in that list, and if
54       lfs.fetchexclude is defined, Git LFS objects will only be fetched if
55       their path does not match one in that list. Paths are matched using
56       wildcard matching as per gitignore(5).
57
58       Note that using the command-line options -I and -X override the
59       respective configuration settings. Setting either option to an empty
60       string clears the value.
61
62   Examples
63       •   git config lfs.fetchinclude "textures,images/foo*"
64
65           This will only fetch objects referenced in paths in the textures
66           folder, and files called foo* in the images folder
67
68       •   git config lfs.fetchinclude ".jpg,.png,*.tga"
69
70           Only fetch JPG/PNG/TGA files, wherever they are in the repository
71
72       git config lfs.fetchexclude "media/reallybigfiles"
73
74           Don’t fetch any LFS objects referenced in the folder
75           media/reallybigfiles, but fetch everything else
76
77       git config lfs.fetchinclude "media" git config lfs.fetchexclude
78           "media/excessive"
79
80           Only fetch LFS objects in the 'media' folder, but exclude those in
81           one of its subfolders.
82

DEFAULT REMOTE

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

DEFAULT REFS

89       If no refs are given as arguments, the currently checked out ref is
90       used. In addition, if enabled, recently changed refs and commits are
91       also included. See RECENT CHANGES for details.
92

RECENT CHANGES

94       If the --recent option is specified, or if the gitconfig option
95       lfs.fetchrecentalways is true, then after the current ref (or those in
96       the arguments) is fetched, we also search for 'recent' changes to fetch
97       objects for, so that it’s more convenient to checkout or diff those
98       commits without incurring further downloads.
99
100       What changes are considered 'recent' is based on a number of gitconfig
101       options:
102
103       lfs.fetchrecentrefsdays
104           If non-zero, includes branches which have commits within N days of
105           the current date. Only local refs are included unless
106           lfs.fetchrecentremoterefs is true. The default is 7 days.
107
108       lfs.fetchrecentremoterefs
109           If true, fetches remote refs (for the remote you’re fetching) as
110           well as local refs in the recent window. This is useful to fetch
111           objects for remote branches you might want to check out later. The
112           default is true; if you set this to false, fetching for those
113           branches will only occur when you either check them out (losing the
114           advantage of fetch --recent), or create a tracking local branch
115           separately then fetch again.
116
117       lfs.fetchrecentcommitsdays
118           In addition to fetching at branches, also fetches changes made
119           within N days of the latest commit on the branch. This is useful if
120           you’re often reviewing recent changes. The default is 0 (no
121           previous changes).
122
123       lfs.fetchrecentalways
124           Always operate as if --recent was provided on the command line.
125

EXAMPLES

127       •   Fetch the LFS objects for the current ref from default remote
128
129           git lfs fetch
130
131       •   Fetch the LFS objects for the current ref AND recent changes from
132           default remote
133
134           git lfs fetch --recent
135
136       •   Fetch the LFS objects for the current ref from a secondary remote
137           'upstream'
138
139           git lfs fetch upstream
140
141       •   Fetch all the LFS objects from the default remote that are
142           referenced by any commit in the main and develop branches
143
144           git lfs fetch --all origin main develop
145
146       •   Fetch the LFS objects for a branch from origin
147
148           git lfs fetch origin mybranch
149
150       •   Fetch the LFS objects for 2 branches and a commit from origin
151
152           git lfs fetch origin main mybranch
153           e445b45c1c9c6282614f201b62778e4c0688b5c8
154

SEE ALSO

156       git-lfs-checkout(1), git-lfs-pull(1), git-lfs-prune(1), gitconfig(5).
157
158       Part of the git-lfs(1) suite.
159
160
161
162                                                              GIT-LFS-FETCH(1)
Impressum