git-annex-metadata(1)
π NAME π
git-annex-metadata β sets or gets metadata of a file β¨
π¦ SYNOPSIS π¦
git annex metadata [path ...]
πΈ DESCRIPTION πΈ
okay so bestie, imagine this: the content of an annexed file can have literally any number of metadata fields attached to it, just to describe it π . and each one of those fields can have any number of values too. it's giving infinite vibes.
this command does two jobs: it can set metadata, or it can show you the metadata that's currently set. main character energy fr.
- when you run it with no
-sor-tparameters at all, it just displays the current metadata. simple as that. β¨
every metadata field has its own little sidekick called field-lastchanged, which holds the date that field was last changed. and unlike other metadata, you cannot directly modify this one with this command β it updates itself automatically. no cap, it's self-sufficient.
β οΈ big important note bestie: metadata is attached to the git-annex key that corresponds to the content of a file, not to a particular filename on a particular git branch. so all files with the same key share the same metadata, and that metadata lives in the git-annex branch. if a file gets modified, the metadata of the previous version will be copied over to the new key when git-annex adds the modified file. π«Ά
π OPTIONS π
-g field/--get fieldβ get the value(s) of a single field. the values come out one per line with no other output, so it's perfect for using inside a script. slay. π₯-s field=value/--set field=valueβ set a field's value, and remove any old values while you're at it. out with the old π-s field+=value/--set field+=valueβ add an additional value, preserving any old values. it's additive, it's generous, it's iconic π-s field?=value/--set field?=valueβ set a value, but only if the field does not already have a value set. shy but respectful.-s field-=value/--set field-=valueβ remove a value from a field, leaving any other values that the field has set. bye bestie π-r field/--remove fieldβ remove all current values of the field. no survivors.-t tag/--tag tagβ set a tag. note that a tag is just a value of the"tag"field. that's it, that's the whole trick. iykyk.-u tag/--unset tagβ unset a tag. β¨--remove-allβ remove all metadata from the specified files.
here's the situation: when a file is modified and the new version is added, git-annex will copy over the metadata from the old version of the file. in situations where you don't want that copied metadata, this option is your girl π
--forceβ by default,git annex metadatarefuses to recursively set metadata throughout the files in a directory. this option enables such recursive setting. consent unlocked π- matching options β the
git-annex-matching-options(1)can be used to control what to act on. π --all -Aβ specify instead of a file to get/set metadata on all known keys.--branch=refβ specify instead of a file to get/set metadata on all files in the specified branch or treeish.--unusedβ specify instead of a file to get/set metadata on files found by last run ofgit-annex unused.--key=keynameβ specify instead of a file to get/set metadata of the specified key.--jsonβ enable JSON output (and input). each line is a JSON object.
the format of the JSON objects changed in git-annex version 6.20160726. so keep that in mind, bestie.
example of the new format:
{"command":"metadata","file":"foo","key":"...","fields":{"author":["bar"],...},"note":"...","success":true}
example of the old format, which lacks the inner fields object:
{"command":"metadata","file":"foo","key":"...","author":["bar"],...,"note":"...","success":true}
--json-error-messagesβ messages that would normally be output to standard error are included in the JSON instead. no stray text, all contained π--batchβ enables batch mode, which can be used to both get, store, and unset metadata for multiple files or keys.
batch currently only supports JSON input. so, you must enable --json along with --batch. both or nothing, periodt.
in batch mode, git-annex reads lines from stdin, which contain JSON objects. it replies to each input annexed file with an output JSON object. (but if the file is not an annexed file, an empty line will be output.)
the format of the JSON sent to git-annex can be the same as the JSON that it outputs. or, a simplified version. only the "file" (or "key") field is actually necessary. lowkey efficient.
for example, to get the current metadata of file foo:
{"file":"foo"}
to get the current metadata of the key k:
{"key":"k"}
any metadata fields included in the JSON object will be stored, replacing whatever values the fields had before. to unset a field, include it with an empty list of values. π«Ά
to change the author of file foo to bar:
{"file":"foo","fields":{"author":["bar"]}}
to remove the author of file foo:
{"file":"foo","fields":{"author":[]}}
- also the
git-annex-common-options(1)can be used. β¨
π EXAMPLES π
to set some tags on a file and also its author:
git annex metadata annexscreencast.ogv -t video -t screencast -s author+=Alice
π SEE ALSO π
π AUTHOR π
Joey Hess <id@joeyh.name>
and that's the whole page bestie!! this was git-annex-metadata(1) from the General Commands Manual, and the footer said git-annex-metadata(1) again because man pages love repeating themselves π β anyway ily, go set some metadata, you're gonna ate π
β¨πΈ
π¦ 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
- debian trixie: git-annex 10.20250416-2 Β· AGPL-3.0-or-later
- debian trixie: git-annex 10.20250416-2+deb13u1 Β· AGPL-3.0-or-later
- epel 10: git-annex 10.20250320-1.el10_0 Β· AGPL-3.0-or-later
- fedora 43: git-annex 10.20250630-4.fc43 Β· AGPL-3.0-or-later
- fedora 43: git-annex 10.20250929-5.fc43 Β· AGPL-3.0-or-later
- fedora 44: git-annex 10.20260115-1.fc44 Β· AGPL-3.0-or-later
- nixos 26.05: git-annex 10.20260421
- nixpkgs unstable: git-annex 10.20260421
- opensuse-leap 16.0: git-annex 10.20250828-bp160.1.1 Β· AGPL-3.0-or-later AND GPL-3.0-or-later AND BSD-2-Clause AND MIT AND GPL-2.0-only
- opensuse-leap 16.0: git-annex 10.20250828-bp160.1.1 Β· AGPL-3.0-or-later AND GPL-3.0-or-later AND BSD-2-Clause AND MIT AND GPL-2.0-only
- opensuse-leap 16.0: git-annex 10.20250828-bp160.1.1 Β· AGPL-3.0-or-later AND GPL-3.0-or-later AND BSD-2-Clause AND MIT AND GPL-2.0-only
- ubuntu noble: git-annex 10.20240129-1build1 Β· AGPL-3.0-or-later
- ubuntu questing: git-annex 10.20250721-1
- ubuntu resolute: git-annex 10.20251029-1ubuntu1 Β· AGPL-3.0-or-later
- ubuntu stonking: git-annex 10.20251029-1ubuntu1 Β· AGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms