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 reposi‐
148 tory make it want to get content. Note that this will match even
149 when the content is already present, unless limited with e.g.,
150 --not --in .
151
152 --want-drop
153 Matches only when the preferred content settings for the reposi‐
154 tory make it want to drop content. Note that this will match
155 even when the content is not present, unless limited with e.g.,
156 --in .
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 --accessedwithin=interval
164 Matches when the content was accessed recently, within the spec‐
165 ified time interval.
166
167 The interval can be in the form "5m" or "1h" or "2d" or "1y", or
168 a combination such as "1h5m".
169
170 So for example, --accessedwithin=1d matches when the content was
171 accessed within the past day.
172
173 If the OS or filesystem does not support access times, this will
174 not match anything.
175
176 --unlocked
177 Matches annexed files that are unlocked.
178
179 --locked
180 Matches annexed files that are locked.
181
182 --mimetype=glob
183 Looks up the MIME type of a file, and checks if the glob matches
184 it.
185
186 For example, --mimetype="text/*" will match many varieties of
187 text files, including "text/plain", but also
188 "text/x-shellscript", "text/x-makefile", etc.
189
190 The MIME types are the same that are displayed by running file
191 --mime-type
192
193 If the file's annexed content is not present, the file will not
194 match.
195
196 This is only available to use when git-annex was built with the
197 MagicMime build flag.
198
199 --mimeencoding=glob
200 Looks up the MIME encoding of a file, and checks if the glob
201 matches it.
202
203 For example, --mimeencoding=binary will match many kinds of bi‐
204 nary files.
205
206 The MIME encodings are the same that are displayed by running
207 file --mime-encoding
208
209 If the file's annexed content is not present, the file will not
210 match.
211
212 This is only available to use when git-annex was built with the
213 MagicMime build flag.
214
215 --not Inverts the next matching option. For example, to match when
216 there are less than 3 copies, use --not --copies=3
217
218 --and Requires that both the previous and the next matching option
219 matches. The default.
220
221 --or Requires that either the previous, or the next matching option
222 matches.
223
224 -( Opens a group of matching options.
225
226 -) Closes a group of matching options.
227
229 git-annex(1)
230
232 Joey Hess <id@joeyh.name>
233
234 git-annex-matching-options(1)