1GIT-LFS-FETCH(1) General Commands Manual GIT-LFS-FETCH(1)
2
3
4
6 git-lfs-fetch - Download all Git LFS files for a given ref
7
9 git lfs fetch [options] [remote [ref...]]
10
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
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
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 Examples:
55 ○ git config lfs.fetchinclude "textures,images/foo*"
56
57 This will only fetch objects referenced in paths in the textures
58 folder, and files called foo* in the images folder
59
60 ○ git config lfs.fetchinclude "*.jpg,*.png,*.tga"
61
62 Only fetch JPG/PNG/TGA files, wherever they are in the repository
63
64 ○ git config lfs.fetchexclude "media/reallybigfiles"
65
66 Don´t fetch any LFS objects referenced in the folder media/really‐
67 bigfiles, but fetch everything else
68
69 ○ git config lfs.fetchinclude "media"
70 git config lfs.fetchexclude "media/excessive"
71
72 Only fetch LFS objects in the ´media´ folder, but exclude those in
73 one of its subfolders.
74
75
76
78 Without arguments, fetch downloads from the default remote. The default
79 remote is the same as for git fetch, i.e. based on the remote branch
80 you´re tracking first, or origin otherwise.
81
83 If no refs are given as arguments, the currently checked out ref is
84 used. In addition, if enabled, recently changed refs and commits are
85 also included. See RECENT CHANGES for details.
86
88 If the --recent option is specified, or if the gitconfig option
89 lfs.fetchrecentalways is true, then after the current ref (or those in
90 the arguments) is fetched, we also search for ´recent´ changes to fetch
91 objects for, so that it´s more convenient to checkout or diff those
92 commits without incurring further downloads.
93
94 What changes are considered ´recent´ is based on a number of gitconfig
95 options:
96
97 ○ lfs.fetchrecentrefsdays If non-zero, includes branches which have
98 commits within N days of the current date. Only local refs are in‐
99 cluded unless lfs.fetchrecentremoterefs is true. The default is 7
100 days.
101
102 ○ lfs.fetchrecentremoterefs If true, fetches remote refs (for the re‐
103 mote you´re fetching) as well as local refs in the recent window.
104 This is useful to fetch objects for remote branches you might want
105 to check out later. The default is true; if you set this to false,
106 fetching for those branches will only occur when you either check
107 them out (losing the advantage of fetch --recent), or create a
108 tracking local branch separately then fetch again.
109
110 ○ lfs.fetchrecentcommitsdays In addition to fetching at branches,
111 also fetches changes made within N days of the latest commit on the
112 branch. This is useful if you´re often reviewing recent changes.
113 The default is 0 (no previous changes).
114
115 ○ lfs.fetchrecentalways Always operate as if --recent was provided on
116 the command line.
117
118
119
121 ○ Fetch the LFS objects for the current ref from default remote
122
123 git lfs fetch
124
125 ○ Fetch the LFS objects for the current ref AND recent changes from
126 default remote
127
128 git lfs fetch --recent
129
130 ○ Fetch the LFS objects for the current ref from a secondary remote
131 ´upstream´
132
133 git lfs fetch upstream
134
135 ○ Fetch all the LFS objects from the default remote that are refer‐
136 enced by any commit in the master and develop branches
137
138 git lfs fetch --all origin master develop
139
140 ○ Fetch the LFS objects for a branch from origin
141
142 git lfs fetch origin mybranch
143
144 ○ Fetch the LFS objects for 2 branches and a commit from origin
145
146 git lfs fetch origin master mybranch
147 e445b45c1c9c6282614f201b62778e4c0688b5c8
148
149
150
152 git-lfs-checkout(1), git-lfs-pull(1), git-lfs-prune(1).
153
154 Part of the git-lfs(1) suite.
155
156
157
158 March 2021 GIT-LFS-FETCH(1)