1GIT-LFS-FETCH(1)            General Commands Manual           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 spec‐
14       ify.
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
21              AND EXCLUDE
22
23       -X paths --exclude=paths
24              Specify lfs.fetchexclude just for this invocation;  see  INCLUDE
25              AND EXCLUDE
26
27       --recent
28              Download  objects referenced by recent branches & commits in ad‐
29              dition to those that would otherwise be downloaded.  See  RECENT
30              CHANGES
31
32       --all  Download all objects that are referenced by any commit reachable
33              from the refs provided as arguments. If no  refs  are  provided,
34              then  all refs are fetched. This is primarily for backup and mi‐
35              gration purposes. Cannot be  combined  with  --recent  or  --in‐
36              clude/--exclude. Ignores any globally configured include and ex‐
37              clude paths to ensure that all objects are downloaded.
38
39       --prune -p
40              Prune old and unreferenced objects after fetching, equivalent to
41              running  git lfs prune afterwards. See git-lfs-prune(1) for more
42              details.
43

INCLUDE AND EXCLUDE

45       You can configure Git LFS to only fetch objects to  satisfy  references
46       in  certain  paths  of the repo, and/or to exclude certain paths of the
47       repo, to reduce the time you spend downloading things you do not use.
48
49       In gitconfig, set lfs.fetchinclude and lfs.fetchexclude to  comma-sepa‐
50       rated  lists of paths to include/exclude in the fetch. Only paths which
51       are matched by fetchinclude and not matched by fetchexclude  will  have
52       objects fetched for them.
53
54       Note that using the command-line options -I and -X override the respec‐
55       tive configuration settings. Setting either option to an  empty  string
56       clears the value.
57
58   Examples:
59git config lfs.fetchinclude "textures,images/foo*"
60
61           This  will  only  fetch objects referenced in paths in the textures
62           folder, and files called foo* in the images folder
63
64git config lfs.fetchinclude "*.jpg,*.png,*.tga"
65
66           Only fetch JPG/PNG/TGA files, wherever they are in the repository
67
68git config lfs.fetchexclude "media/reallybigfiles"
69
70           Don´t fetch any LFS objects referenced in the folder  media/really‐
71           bigfiles, but fetch everything else
72
73git config lfs.fetchinclude "media"
74           git config lfs.fetchexclude "media/excessive"
75
76           Only  fetch LFS objects in the ´media´ folder, but exclude those in
77           one of its subfolders.
78
79
80

DEFAULT REMOTE

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

DEFAULT REFS

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

RECENT CHANGES

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

EXAMPLES

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

SEE ALSO

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