Debian Codegraph @

docs/man/git-lfs-fetch.adoc

raw
1 = git-lfs-fetch(1)
2
3 == NAME
4
5 git-lfs-fetch - Download all Git LFS files for a given ref
6
7 == SYNOPSIS
8
9 [source,role=synopsis,subs="verbatim,quotes"]
10 ----
11 *git lfs fetch* [_options_] [_<remote>_ [_<ref>_...]]
12 *git lfs fetch* [_options_] _<remote>_ *--stdin*
13 ----
14
15 == DESCRIPTION
16
17 Download Git LFS objects at the given refs from the specified remote.
18 See <<_default_remote>> and <<_default_refs>> for what happens if you don't
19 specify.
20
21 This does not update the working copy.
22
23 == OPTIONS
24
25 `-I <paths>`::
26 `--include=<paths>`::
27 Specify lfs.fetchinclude just for this invocation; see
28 <<_include_and_exclude>>.
29 `-X <paths>`::
30 `--exclude=<paths>`::
31 Specify lfs.fetchexclude just for this invocation; see
32 <<_include_and_exclude>>.
33 `-r`::
34 `--recent`::
35 Download objects referenced by recent branches & commits in addition to those
36 that would otherwise be downloaded. See <<_recent_changes>>.
37 `-a`::
38 `--all`::
39 Download all objects that are referenced by any commit reachable from the refs
40 provided as arguments. If no refs are provided, then all refs are fetched.
41 This is primarily for backup and migration purposes. Cannot be combined with
42 --recent or --include/--exclude. Ignores any globally configured include and
43 exclude paths to ensure that all objects are downloaded.
44 `--stdin`::
45 Read a list of newline-delimited refs from standard input instead of the
46 command line.
47 `-p`::
48 `--prune`::
49 Prune old and unreferenced objects after fetching, equivalent to running `git
50 lfs prune` afterwards. See git-lfs-prune(1) for more details.
51 `--refetch`::
52 Also fetch objects that are already present locally.
53 `-d`::
54 `--dry-run`::
55 Print what would be fetched, without actually fetching anything.
56 `-j`::
57 `--json`::
58 Writes the details of all object transfer requests as JSON to STDOUT,
59 if the command exits successfully. Intended for interoperation with
60 external tools. When `--dry-run` is also specified, writes the details
61 of the transfers that would occur if the objects were fetched.
62
63 == INCLUDE AND EXCLUDE
64
65 You can configure Git LFS to only fetch objects to satisfy references in
66 certain paths of the repo, and/or to exclude certain paths of the repo,
67 to reduce the time you spend downloading things you do not use.
68
69 In your Git configuration or in a `.lfsconfig` file, you may set either
70 or both of `lfs.fetchinclude` and `lfs.fetchexclude` to comma-separated
71 lists of paths. If `lfs.fetchinclude` is defined, Git LFS objects will
72 only be fetched if their path matches one in that list, and if
73 `lfs.fetchexclude` is defined, Git LFS objects will only be fetched if
74 their path does not match one in that list. Paths are matched using
75 wildcard matching as per gitignore(5).
76
77 Note that using the command-line options `-I` and `-X` override the
78 respective configuration settings. Setting either option to an empty
79 string clears the value.
80
81 === Examples
82
83 * `git config lfs.fetchinclude "textures,images/foo*"`
84 +
85 This will only fetch objects referenced in paths in the textures folder,
86 and files called foo* in the images folder
87 * `git config lfs.fetchinclude "*.jpg,*.png,*.tga"`
88 +
89 Only fetch JPG/PNG/TGA files, wherever they are in the repository
90 * `git config lfs.fetchexclude "media/reallybigfiles"`
91 +
92 Don't fetch any LFS objects referenced in the folder
93 media/reallybigfiles, but fetch everything else
94 * `git config lfs.fetchinclude "media"`
95 `git config lfs.fetchexclude "media/excessive"`
96 +
97 Only fetch LFS objects in the 'media' folder, but exclude those in one
98 of its subfolders.
99
100 == DEFAULT REMOTE
101
102 Without arguments, fetch downloads from the default remote. The default
103 remote is the same as for `git fetch`, i.e. based on the remote branch
104 you're tracking first, or origin otherwise.
105
106 == DEFAULT REFS
107
108 If no refs are given as arguments, the currently checked out ref is
109 used. In addition, if enabled, recently changed refs and commits are
110 also included. See <<_recent_changes>> for details.
111
112 == RECENT CHANGES
113
114 If the `--recent` option is specified, or if the gitconfig option
115 `lfs.fetchrecentalways` is true, then after the current ref (or those in
116 the arguments) is fetched, we also search for 'recent' changes to fetch
117 objects for, so that it's more convenient to checkout or diff those
118 commits without incurring further downloads.
119
120 What changes are considered 'recent' is based on a number of gitconfig
121 options:
122
123 `lfs.fetchrecentrefsdays`::
124 If non-zero, includes branches which have
125 commits within N days of the current date. Only local refs are included
126 unless lfs.fetchrecentremoterefs is true. The default is 7 days.
127 `lfs.fetchrecentremoterefs`::
128 If true, fetches remote refs (for the remote you're fetching) as well as local
129 refs in the recent window. This is useful to fetch objects for remote branches
130 you might want to check out later. The default is true; if you set this to
131 false, fetching for those branches will only occur when you either check them
132 out (losing the advantage of fetch --recent), or create a tracking local
133 branch separately then fetch again.
134 `lfs.fetchrecentcommitsdays`::
135 In addition to fetching at branches, also fetches changes made within N days
136 of the latest commit on the branch. This is useful if you're often reviewing
137 recent changes. The default is 0 (no previous changes).
138 `lfs.fetchrecentalways`::
139 Always operate as if --recent was provided on the command line.
140
141 == EXAMPLES
142
143 * Fetch the LFS objects for the current ref from default remote
144 +
145 `git lfs fetch`
146 * Fetch the LFS objects for the current ref AND recent changes from
147 default remote
148 +
149 `git lfs fetch --recent`
150 * Fetch the LFS objects for the current ref from a secondary remote
151 'upstream'
152 +
153 `git lfs fetch upstream`
154 * Fetch all the LFS objects from the default remote that are referenced
155 by any commit in the `main` and `develop` branches
156 +
157 `git lfs fetch --all origin main develop`
158 * Fetch the LFS objects for a branch from origin
159 +
160 `git lfs fetch origin mybranch`
161 * Fetch the LFS objects for 2 branches and a commit from origin
162 +
163 `git lfs fetch origin main mybranch e445b45c1c9c6282614f201b62778e4c0688b5c8`
164
165 == SEE ALSO
166
167 git-lfs-checkout(1), git-lfs-pull(1), git-lfs-prune(1), gitconfig(5).
168
169 Part of the git-lfs(1) suite.