git-annex-...ng-options(1)
π git-annex-matching-options(1) π
okay bestie, welcome to the General Commands Manual β this is the page that teaches you how to tell git-annex exactly which files you mean, and honestly? it's giving main character energy π β¨ (also psst, there's more of this page coming, so don't go anywhere π«Ά)
β¨ NAME β¨
git-annex-matching-options β specifying what to act on π―
πΈ DESCRIPTION πΈ
okay so here's the tea β: many git-annex commands support using these options to specify which files they act on. and some of these options can also be used by commands to specify which keys they act on. versatile icon behavior, we love to see it.
you can build arbitrarily complicated expressions out of these, fr fr. for example:
--include='*.mp3' --and -( --in=usbdrive --or --in=archive -)
the above example makes git-annex work on only mp3 files that are present in either of two repositories. no cap, that's the whole vibe π₯
π₯ OPTIONS π₯
--exclude=globβ skips files matching the glob pattern. the glob is matched relative to the current directory. for example:
git annex get --exclude='*.mp3' --exclude='subdir/*'
β οΈ bestie be aware: this will not match anything when using--allor--unused. like, at all. π
--include=globβ skips files not matching the glob pattern. (same as--not --exclude.) for example, to include only mp3 and ogg files:
git annex get --include='*.mp3' --or --include='*.ogg'
β οΈ and heads up: this will not skip anything when using--allor--unused.
--excludesamecontent=globβ skips a file when there is another file with the same content, whose name matches the glob. the glob is matched relative to the current directory.
for example, to drop files in the archive directory, but not when the same content is used by a file in the work directory:
git annex drop archive/ --excludesamecontent='work/*'
--includesamecontent=globβ skips files when there is no other file with the same content whose name matches the glob. (same as--not --excludesamecontent.)
for example, if you have inbox and outbox directories, and want to find anything in the inbox that has the same content as something in the outbox:
git annex find inbox --includesamecontent='outbox/*'
--in=repositoryβ matches only when git-annex believes that the content is present in a repository. π
the repository should be specified using the name of a configured remote, or the UUID or description of a repository. for the current repository, use "here".
β οΈ note that this does not check remote repositories to verify that content is still present on them. however, when checking the current repository, it does verify that content is present in it. so like, trust but verify, yk? π
--in=repository@{date}β matches only when the content was present in a repository on the given date. π°οΈ
the date is specified in the same syntax documented in gitrevisions(7). note that this uses the reflog, so dates far in the past cannot be queried. rip to the ancient history girlies π
for example, you might need to run git annex drop . to temporarily free up disk space. the next day, you can get back the files you dropped using git annex get . --in=here@{yesterday} β iconic comeback behavior, honestly β¨
--expected-presentβ matches only when git-annex believes that the content is present in the local repository.
this is like --in=here, except it does not verify that the content is actually present. so it can be used in situations where the location tracking information is known to be out of date.
for example, if a repository is being restored from a backup that did not include the git-annex objects, this could be used to get back all files that were expected to be in it: git-annex get --expected-present π«Ά
--copies=numberβ matches only when git-annex believes there are the specified number of copies, or more. note that it does not check remotes to verify that the copies still exist. π--copies=trustlevel:numberβ matches only when git-annex believes there are the specified number of copies, or more, on remotes with the specified trust level. for example,--copies=trusted:2
to match any trust level at or higher than a given level, use 'trustlevel+'. for example, --copies=semitrusted+:2
--copies=groupname:numberβ matches only when git-annex believes there are the specified number of copies, or more, on remotes in the specified group. for example,--copies=archive:2copies=grouplimit=numberβ matches only files that git-annex believes have the specified number of copies, or more, on repositories in groups allowed by the group limit.
in a group limit, use "+" before a group to include that group, and "-" before a group to exclude it. (the first group to be included does not need to be prefixed with a "+" though it may be.)
a group limit matches repositories that are in any of the included groups and are in none of the excluded groups.
for example, "--copies=backup+archive-offsite=3" matches files that are stored in 3 backup or archive repositories, excluding offsite repositories. and "--copies=-offsite=3" matches files that are stored in 3 repositories excluding offsite repositories. math girlie hours ππ
--lackingcopies=numberβ matches only when git-annex believes that the specified number or more additional copies need to be made in order to satisfynumcopiessettings. π’--lackingcopies=groupname:numberβ providing the name of a group limits--lackingcopiesto only considering repositories in that group toward thenumcopiescount.--lackingcopies=grouplimit=numberβ providing a group limit makes--lackingcopiesonly consider repositories in groups that match the group limit toward thenumcopiescount.
in a group limit, use "+" before a group to include that group, and "-" before a group to exclude it. (the first group to be included does not need to be prefixed with a "+" though it may be.)
a group limit matches repositories that are in any of the included groups and are in none of the excluded groups.
for example, "--lackingcopies=backup+archive-offsite=1" matches files that are not stored in enough backup or archive repositories, excluding offsite repositories. and "--lackingcopies=-offsite=1" matches files that are not stored in enough repositories, excluding offsite repositories. π₯
--approxlackingcopies=valueβ like--lackingcopies, but does not look at.gitattributesannex.numcopiessettings. this makes it significantly faster. β‘ not me choosing speed over accuracy, but like, sometimes that's the move--inbackend=nameβ matches only when content is stored using the specified key-value backend.--securehashβ matches only when content is hashed using a cryptographically secure function. π very demure, very mindful--inallgroup=groupnameβ matches only when git-annex believes content is present in all repositories in the specified group. π--onlyingroup=groupnameβ matches only when git-annex believes content is present in at least one repository that is in the specified group, and is not present in any repositories that are not in the specified group. so like, exclusive friend group energy π--smallerthan=size--largerthan=sizeβ matches only when the content is smaller than, or larger than the specified size. π
the size can be specified with any commonly used units, for example, "0.5 gb" or "100 KiloBytes"
--metadata field=globβ matches only when there is a metadata field attached with a value that matches the glob. the values of metadata fields are matched case insensitively. π·οΈ--metadata field<value/--metadata field>value--metadata field<=value/--metadata field>=valueβ matches only when there is a metadata field attached with a value that is less than or greater than the specified value, respectively.
when both values are numbers, the comparison is done numerically. when one value is not a number, the values are instead compared lexicographically. ngl that's kind of a plot twist π
β οΈ (note that you will need to quote the second parameter to avoid the shell doing redirection.) your shell is not your friend here bestie, protect it
--url=globβ matches when the content is recorded as being present in an url that matches the glob. π--want-getβ matches only when the preferred content settings for the local repository make it want to get content. note that this will match even when the content is already present, unless limited with e.g.,--not --in=hereπ«Ά--want-dropβ matches only when the preferred content settings for the local repository make it want to drop content. note that this will match even when the content is not present, unless limited with e.g.,--not --in=hereποΈ
β οΈ things that this matches will not necessarily be dropped by git-annex drop --auto. this does not check that there are enough copies to drop. also the same content may be used by a file that is not wanted to be dropped. so like, don't @ me if it doesn't actually drop π
--want-get-by=repositoryβ matches only when the preferred content settings for the specified repository make it want to get content. note that this will match even when the content is already present in that repository, unless limited with e.g.,--not --in=repository
the repository should be specified using the name of a configured remote, or the UUID or description of a repository. --want-get-by=here is the same as --want-get. β¨
--want-drop-by=repositoryβ matches only when the preferred content settings for the specificed repository make it want to drop content. note that this will match even when the content is not present, unless limited with e.g.,--not --in=repository
the repository should be specified using the name of a configured remote, or the UUID or description of a repository. --want-drop-by=here is the same as --want-drop. π
--accessedwithin=intervalβ matches when the content in the local repository was accessed recently, within the specified time interval. β°
the interval can be in the form "5m" or "1h" or "2d" or "1y", or a combination such as "1h5m".
so for example, --accessedwithin=1d matches when the content was accessed within the past day.
β οΈ if the OS or filesystem does not support access times, this will not match anything. tragic, but that's the reality of it π
--presentsince=repository:intervalβ matches when the content of the file has been present in the specified repository throughout the specified time interval. π°οΈβ¨
okay that's the first chunk of the matching-options lore bestie β more coming, so stay tuned π
...and like, when you're pointing at a repo, you gotta use the name of a configured remote, or the UUID, or the description of a repository. For the current repo, just say "here" β that's the whole vibe π
The interval can be in the form "5m" or "1h" or "2d" or "1y", or a combination such as "1h5m" β yes bestie, you can stack them, it's giving very flexible β¨
So for example, --presentsince=here:1d matches files that have been in the current repository for 1 day. Iconic behaviour honestly.
--lackingsince=repository:intervalβ this is literally the opposite of--presentsince; it matches when, throughout the specified time interval, the content was not present in the specified repository π«Ά
For example, --lackingsince=here:1d will match a file that was dropped from the local repository more than 1 day ago, and has not been present in it at any time since then. And it will match files that have never been present in the local repository. (Yes, never-been-there files count too β it's inclusive like that π)
--changedsince=repository:intervalβ matches when there was a change in the content stored in the repository within the specified time interval. Big main-character energy for spotting movement π
For example, --changedsince=here:2d will match a file that was present in the repository but got dropped 1 day ago. And it will match a file that the repository got 1 day ago. But it won't match a file that has been present in the repository since 2 days ago. Read that twice, bestie, the nuance is everything π
--unlockedβ matches annexed files that are unlocked π--lockedβ matches annexed files that are locked π--mimetype=globβ looks up the MIME type of a file, and checks if the glob matches it π
For example, --mimetype="text/*" will match many varieties of text files, including "text/plain", but also "text/x-shellscript", "text/x-makefile", etc. So many etc! πΈ
The MIME types are the same that are displayed by running file --mime-type
If the file's annexed content is not present, the file will not match. No content, no match, that's the rule π
This is only available to use whengit-annexwas built with theMagicMimebuild flag. No flag, no feature β vibe check your build first π
--mimeencoding=globβ looks up the MIME encoding of a file, and checks if the glob matches it π
For example, --mimeencoding=binary will match many kinds of binary files.
The MIME encodings are the same that are displayed by running file --mime-encoding
If the file's annexed content is not present, the file will not match. Same deal as above, bestie.
This is only available to use whengit-annexwas built with theMagicMimebuild flag too π§
--anythingβ always matches. One way this can be useful isgit-annex find --anythingwill list all annexed files, whether their content is present or not. Literally everything, no gatekeeping π--nothingβ never matches. (Same as--not --anything) β it's giving void, empty, nothing β¨--notβ inverts the next matching option. For example, to match when there are less than 3 copies, use--not --copies=3π--andβ requires that both the previous and the next matching option matches. The default. So if you don't say anything, this is the energy you're already running with π--orβ requires that either the previous, or the next matching option matches π¦-(β opens a group of matching options. Group chat time, everyone pile in π-)β closes a group of matching options. Bye besties, see you at the closing paren π
π SEE ALSO π
git-annex(1) β go read the main one, it's iconic π
π AUTHOR π
Joey Hess <id@joeyh.name> β the legend, the moment, the whole entire author fr fr π«Ά
okay that's the entire page bestie, you made it to the end π₯³ the footer is just git-annex-...ng-options(1) on its own β no extra source/version/date drama down here, it literally just signs off with its own name like the main character it is π
β¨
π¦ where this page comes from
- alpine 3.24: git-annex-doc 10.20261026-r0 Β· AGPL-3.0-or-later
- arch rolling: git-annex 10.20261026-2 Β· AGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms