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 your Git configuration or in a .lfsconfig file, you may  set  either
50       or  both  of  lfs.fetchinclude  and lfs.fetchexclude to comma-separated
51       lists of paths. If lfs.fetchinclude is defined, Git  LFS  objects  will
52       only  be  fetched  if  their  path  matches  one  in  that list, and if
53       lfs.fetchexclude is defined, Git LFS objects will only  be  fetched  if
54       their  path  does  not  match one in that list. Paths are matched using
55       wildcard matching as per gitignore(5).
56
57       Note that using the command-line options -I and -X override the respec‐
58       tive  configuration  settings. Setting either option to an empty string
59       clears the value.
60
61   Examples
62git config lfs.fetchinclude "textures,images/foo*"
63
64           This will only fetch objects referenced in paths  in  the  textures
65           folder, and files called foo* in the images folder
66
67git config lfs.fetchinclude "*.jpg,*.png,*.tga"
68
69           Only fetch JPG/PNG/TGA files, wherever they are in the repository
70
71git config lfs.fetchexclude "media/reallybigfiles"
72
73           Don´t  fetch any LFS objects referenced in the folder media/really‐
74           bigfiles, but fetch everything else
75
76git config lfs.fetchinclude "media"
77           git config lfs.fetchexclude "media/excessive"
78
79           Only fetch LFS objects in the ´media´ folder, but exclude those  in
80           one of its subfolders.
81
82
83

DEFAULT REMOTE

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

DEFAULT REFS

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

RECENT CHANGES

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

EXAMPLES

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

SEE ALSO

159       git-lfs-checkout(1), git-lfs-pull(1), git-lfs-prune(1), gitconfig(5).
160
161       Part of the git-lfs(1) suite.
162
163
164
165                                   May 2022                   GIT-LFS-FETCH(1)
Impressum