1GIT-LFS-FETCH(1) 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
29 addition to those that would otherwise be downloaded. See RECENT
30 CHANGES
31
32 --all Download all objects referenced by any commit that is reachable;
33 this is primarily for backup / migration purposes. Cannot be
34 combined with --recent or --include/--exclude. Ignores any glob‐
35 ally configured include and exclude paths to ensure that all
36 objects are downloaded.
37
38 --prune -p
39 Prune old and unreferenced objects after fetching, equivalent to
40 running git lfs prune afterwards. See git-lfs-prune(1) for more
41 details.
42
44 You can configure Git LFS to only fetch objects to satisfy references
45 in certain paths of the repo, and/or to exclude certain paths of the
46 repo, to reduce the time you spend downloading things you do not use.
47
48 In gitconfig, set lfs.fetchinclude and lfs.fetchexclude to comma-sepa‐
49 rated lists of paths to include/exclude in the fetch. Only paths which
50 are matched by fetchinclude and not matched by fetchexclude will have
51 objects fetched for them.
52
53 Examples:
54 · git config lfs.fetchinclude "textures,images/foo*"
55
56 This will only fetch objects referenced in paths in the textures
57 folder, and files called foo* in the images folder
58
59 · git config lfs.fetchinclude "*.jpg,*.png,*.tga"
60
61 Only fetch JPG/PNG/TGA files, wherever they are in the repository
62
63 · git config lfs.fetchexclude "media/reallybigfiles"
64
65 Don´t fetch any LFS objects referenced in the folder media/really‐
66 bigfiles, but fetch everything else
67
68 · git config lfs.fetchinclude "media"
69 git config lfs.fetchexclude "media/excessive"
70
71 Only fetch LFS objects in the ´media´ folder, but exclude those in
72 one of its subfolders.
73
74
75
77 Without arguments, fetch downloads from the default remote. The default
78 remote is the same as for git fetch, i.e. based on the remote branch
79 you´re tracking first, or origin otherwise.
80
82 If no refs are given as arguments, the currently checked out ref is
83 used. In addition, if enabled, recently changed refs and commits are
84 also included. See RECENT CHANGES for details.
85
87 If the --recent option is specified, or if the gitconfig option
88 lfs.fetchrecentalways is true, then after the current ref (or those in
89 the arguments) is fetched, we also search for ´recent´ changes to fetch
90 objects for, so that it´s more convenient to checkout or diff those
91 commits without incurring further downloads.
92
93 What changes are considered ´recent´ is based on a number of gitconfig
94 options:
95
96 · lfs.fetchrecentrefsdays If non-zero, includes branches which have
97 commits within N days of the current date. Only local refs are
98 included unless lfs.fetchrecentremoterefs is true. The default is 7
99 days.
100
101 · lfs.fetchrecentremoterefs If true, fetches remote refs (for the
102 remote you´re fetching) as well as local refs in the recent window.
103 This is useful to fetch objects for remote branches you might want
104 to check out later. The default is true; if you set this to false,
105 fetching for those branches will only occur when you either check
106 them out (losing the advantage of fetch --recent), or create a
107 tracking local branch separately then fetch again.
108
109 · lfs.fetchrecentcommitsdays In addition to fetching at branches,
110 also fetches changes made within N days of the latest commit on the
111 branch. This is useful if you´re often reviewing recent changes.
112 The default is 0 (no previous changes).
113
114 · lfs.fetchrecentalways Always operate as if --recent was provided on
115 the command line.
116
117
118
120 · Fetch the LFS objects for the current ref from default remote
121
122 git lfs fetch
123
124 · Fetch the LFS objects for the current ref AND recent changes from
125 default remote
126
127 git lfs fetch --recent
128
129 · Fetch the LFS objects for the current ref from a secondary remote
130 ´upstream´
131
132 git lfs fetch upstream
133
134 · Fetch the LFS objects for a branch from origin
135
136 git lfs fetch origin mybranch
137
138 · Fetch the LFS objects for 2 branches and a commit from origin
139
140 git lfs fetch origin master mybranch
141 e445b45c1c9c6282614f201b62778e4c0688b5c8
142
143
144
146 git-lfs-checkout(1), git-lfs-pull(1), git-lfs-prune(1).
147
148 Part of the git-lfs(1) suite.
149
150
151
152 April 2019 GIT-LFS-FETCH(1)