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<number / --metadata field>number
137
138 --metadata field<=number / --metadata field>=number
139 Matches only when there is a metadata field attached with a
140 value that is a number and is less than or greater than the
141 specified number.
142
143 (Note that you will need to quote the second parameter to avoid
144 the shell doing redirection.)
145
146 --want-get
147 Matches only when the preferred content settings for the local
148 repository make it want to get content. Note that this will
149 match even when the content is already present, unless limited
150 with e.g., --not --in=here
151
152 --want-drop
153 Matches only when the preferred content settings for the local
154 repository make it want to drop content. Note that this will
155 match even when the content is not present, unless limited with
156 e.g., --not --in=here
157
158 Things that this matches will not necessarily be dropped by git-
159 annex drop --auto. This does not check that there are enough
160 copies to drop. Also the same content may be used by a file that
161 is not wanted to be dropped.
162
163 --want-get-by=repository
164 Matches only when the preferred content settings for the speci‐
165 fied repository make it want to get content. Note that this will
166 match even when the content is already present in that reposi‐
167 tory, unless limited with e.g., --not --in=repository
168
169 The repository should be specified using the name of a config‐
170 ured remote, or the UUID or description of a repository.
171 --want-get-by=here is the same as --want-get.
172
173 --want-drop-by=repository
174 Matches only when the preferred content settings for the speci‐
175 ficed repository make it want to drop content. Note that this
176 will match even when the content is not present, unless limited
177 with e.g., --not --in=repository
178
179 The repository should be specified using the name of a config‐
180 ured remote, or the UUID or description of a repository.
181 --want-drop-by=here is the same as --want-drop.
182
183 --accessedwithin=interval
184 Matches when the content was accessed recently, within the spec‐
185 ified time interval.
186
187 The interval can be in the form "5m" or "1h" or "2d" or "1y", or
188 a combination such as "1h5m".
189
190 So for example, --accessedwithin=1d matches when the content was
191 accessed within the past day.
192
193 If the OS or filesystem does not support access times, this will
194 not match anything.
195
196 --unlocked
197 Matches annexed files that are unlocked.
198
199 --locked
200 Matches annexed files that are locked.
201
202 --mimetype=glob
203 Looks up the MIME type of a file, and checks if the glob matches
204 it.
205
206 For example, --mimetype="text/*" will match many varieties of
207 text files, including "text/plain", but also
208 "text/x-shellscript", "text/x-makefile", etc.
209
210 The MIME types are the same that are displayed by running file
211 --mime-type
212
213 If the file's annexed content is not present, the file will not
214 match.
215
216 This is only available to use when git-annex was built with the
217 MagicMime build flag.
218
219 --mimeencoding=glob
220 Looks up the MIME encoding of a file, and checks if the glob
221 matches it.
222
223 For example, --mimeencoding=binary will match many kinds of bi‐
224 nary files.
225
226 The MIME encodings are the same that are displayed by running
227 file --mime-encoding
228
229 If the file's annexed content is not present, the file will not
230 match.
231
232 This is only available to use when git-annex was built with the
233 MagicMime build flag.
234
235 --not Inverts the next matching option. For example, to match when
236 there are less than 3 copies, use --not --copies=3
237
238 --and Requires that both the previous and the next matching option
239 matches. The default.
240
241 --or Requires that either the previous, or the next matching option
242 matches.
243
244 -( Opens a group of matching options.
245
246 -) Closes a group of matching options.
247
249 git-annex(1)
250
252 Joey Hess <id@joeyh.name>
253
254 git-annex-matching-options(1)