1git-annex-matching-options(1)General Commands Manuaglit-annex-matching-options(1)
2
3
4
6 git-annex-matching-options - specifying what to act on
7
9 Many git-annex commands support using these options to specify which
10 files they act on. Some of these options can also be used by commands
11 to specify which keys they act on.
12
13 Arbitrarily complicated expressions can be built using these options.
14 For example:
15
16 --include='*.mp3' --and -( --in=usbdrive --or --in=archive -)
17
18 The above example makes git-annex work on only mp3 files that are
19 present in either of two repositories.
20
22 --exclude=glob
23
24 Skips files matching the glob pattern. The glob is matched rela‐
25 tive to the current directory. For example:
26
27 git annex get --exclude='*.mp3' --exclude='subdir/*'
28
29 Note that this will not match anything when using --all or --un‐
30 used.
31
32 --include=glob
33 Skips files not matching the glob pattern. (Same as --not --ex‐
34 clude.) For example, to include only mp3 and ogg files:
35
36 git annex get --include='*.mp3' --or --include='*.ogg'
37
38 Note that this will not skip anything when using --all or --un‐
39 used.
40
41 --excludesamecontent=glob
42 Skips a file when there is another file with the same content,
43 whose name matches the glob. The glob is matched relative to the
44 current directory.
45
46 For example, to drop files in the archive directory, but not
47 when the same content is used by a file in the work directory:
48
49 git annex drop archive/ --excludesamecontent='work/*'
50
51 --includesamecontent=glob
52 Skips files when there is no other file with the same content
53 whose name matches the glob. (Same as --not --includesamecon‐
54 tent)
55
56 For example, if you have inbox and outbox directories, and want
57 to find anything in the inbox that has the same content as some‐
58 thing in the outbox:
59
60 git annex find inbox --includesamecontent='outbox/*'
61
62 --in=repository
63 Matches only when git-annex believes that the content is present
64 in a repository. Note that it does not check the repository to
65 verify that it still has the content.
66
67 The repository should be specified using the name of a config‐
68 ured remote, or the UUID or description of a repository. For the
69 current repository, use --in=here
70
71 --in=repository@{date}
72 Matches only when the content was present in a repository on the
73 given date.
74
75 The date is specified in the same syntax documented in gitrevi‐
76 sions(7). Note that this uses the reflog, so dates far in the
77 past cannot be queried.
78
79 For example, you might need to run git annex drop . to temporar‐
80 ily free up disk space. The next day, you can get back the files
81 you dropped using git annex get . --in=here@{yesterday}
82
83 --copies=number
84 Matches only when git-annex believes there are the specified
85 number of copies, or more. Note that it does not check remotes
86 to verify that the copies still exist.
87
88 --copies=trustlevel:number
89 Matches only when git-annex believes there are the specified
90 number of copies, on remotes with the specified trust level. For
91 example, --copies=trusted:2
92
93 To match any trust level at or higher than a given level, use
94 'trustlevel+'. For example, --copies=semitrusted+:2
95
96 --copies=groupname:number
97 Matches only when git-annex believes there are the specified
98 number of copies, on remotes in the specified group. For exam‐
99 ple, --copies=archive:2
100
101 --lackingcopies=number
102 Matches only when git-annex beleives that the specified number
103 or more additional copies to be made in order to satisfy num‐
104 copies settings.
105
106 --approxlackingcopies=number
107 Like lackingcopies, but does not look at .gitattributes an‐
108 nex.numcopies settings. This makes it significantly faster.
109
110 --inbackend=name
111 Matches only when content is stored using the specified
112 key-value backend.
113
114 --securehash
115 Matches only when content is hashed using a cryptographically
116 secure function.
117
118 --inallgroup=groupname
119 Matches only when git-annex believes content is present in all
120 repositories in the specified group.
121
122 --smallerthan=size
123
124 --largerthan=size
125 Matches only when the content is is smaller than, or larger than
126 the specified size.
127
128 The size can be specified with any commonly used units, for ex‐
129 ample, "0.5 gb" or "100 KiloBytes"
130
131 --metadata field=glob
132 Matches only when there is a metadata field attached with a
133 value that matches the glob. The values of metadata fields are
134 matched case insensitively.
135
136 --metadata field<value / --metadata field>value
137
138 --metadata field<=value / --metadata field>=value
139 Matches only when there is a metadata field attached with a
140 value that is less then or greater than the specified value, re‐
141 spectively.
142
143 When both values are numbers, the comparison is done numeri‐
144 cally. When one value is not a number, the values are instead
145 compared lexicographically.
146
147 (Note that you will need to quote the second parameter to avoid
148 the shell doing redirection.)
149
150 --want-get
151 Matches only when the preferred content settings for the local
152 repository make it want to get content. Note that this will
153 match even when the content is already present, unless limited
154 with e.g., --not --in=here
155
156 --want-drop
157 Matches only when the preferred content settings for the local
158 repository make it want to drop content. Note that this will
159 match even when the content is not present, unless limited with
160 e.g., --not --in=here
161
162 Things that this matches will not necessarily be dropped by git-
163 annex drop --auto. This does not check that there are enough
164 copies to drop. Also the same content may be used by a file that
165 is not wanted to be dropped.
166
167 --want-get-by=repository
168 Matches only when the preferred content settings for the speci‐
169 fied repository make it want to get content. Note that this will
170 match even when the content is already present in that reposi‐
171 tory, unless limited with e.g., --not --in=repository
172
173 The repository should be specified using the name of a config‐
174 ured remote, or the UUID or description of a repository.
175 --want-get-by=here is the same as --want-get.
176
177 --want-drop-by=repository
178 Matches only when the preferred content settings for the speci‐
179 ficed repository make it want to drop content. Note that this
180 will match even when the content is not present, unless limited
181 with e.g., --not --in=repository
182
183 The repository should be specified using the name of a config‐
184 ured remote, or the UUID or description of a repository.
185 --want-drop-by=here is the same as --want-drop.
186
187 --accessedwithin=interval
188 Matches when the content was accessed recently, within the spec‐
189 ified time interval.
190
191 The interval can be in the form "5m" or "1h" or "2d" or "1y", or
192 a combination such as "1h5m".
193
194 So for example, --accessedwithin=1d matches when the content was
195 accessed within the past day.
196
197 If the OS or filesystem does not support access times, this will
198 not match anything.
199
200 --unlocked
201 Matches annexed files that are unlocked.
202
203 --locked
204 Matches annexed files that are locked.
205
206 --mimetype=glob
207 Looks up the MIME type of a file, and checks if the glob matches
208 it.
209
210 For example, --mimetype="text/*" will match many varieties of
211 text files, including "text/plain", but also
212 "text/x-shellscript", "text/x-makefile", etc.
213
214 The MIME types are the same that are displayed by running file
215 --mime-type
216
217 If the file's annexed content is not present, the file will not
218 match.
219
220 This is only available to use when git-annex was built with the
221 MagicMime build flag.
222
223 --mimeencoding=glob
224 Looks up the MIME encoding of a file, and checks if the glob
225 matches it.
226
227 For example, --mimeencoding=binary will match many kinds of bi‐
228 nary files.
229
230 The MIME encodings are the same that are displayed by running
231 file --mime-encoding
232
233 If the file's annexed content is not present, the file will not
234 match.
235
236 This is only available to use when git-annex was built with the
237 MagicMime build flag.
238
239 --anything
240 Always matches. One way this can be useful is git-annex find
241 --anything will list all annexed files, whether their content is
242 present or not.
243
244 --nothing
245 Never matches. (Same as --not --anything)
246
247 --not Inverts the next matching option. For example, to match when
248 there are less than 3 copies, use --not --copies=3
249
250 --and Requires that both the previous and the next matching option
251 matches. The default.
252
253 --or Requires that either the previous, or the next matching option
254 matches.
255
256 -( Opens a group of matching options.
257
258 -) Closes a group of matching options.
259
261 git-annex(1)
262
264 Joey Hess <id@joeyh.name>
265
266 git-annex-matching-options(1)