1git-annex-metadata(1) General Commands Manual git-annex-metadata(1)
2
3
4
6 git-annex-metadata - sets or gets metadata of a file
7
9 git annex metadata [path ...]
10
12 The content of an annexed file can have any number of metadata fields
13 attached to it to describe it. Each metadata field can in turn have any
14 number of values.
15
16 This command can be used to set metadata, or show the currently set
17 metadata.
18
19 When run without any -s or -t parameters, displays the current meta‐
20 data.
21
22 Each metadata field has its own "field-lastchanged" metadata, which
23 contains the date the field was last changed. Unlike other metadata,
24 this cannot be directly modified by this command. It is updated auto‐
25 matically.
26
27 Note that the metadata is attached to git-annex key corresponding to
28 the content of a file, not to a particular filename on a particular git
29 branch. All files with the same key share the same metadata, which is
30 stored in the git-annex branch. If a file is modified, the metadata of
31 the previous version will be copied to the new key when git-annex adds
32 the modified file.
33
35 -g field / --get field
36
37 Get the value(s) of a single field.
38
39 The values will be output one per line, with no other output, so
40 this is suitable for use in a script.
41
42 -s field=value / --set field=value
43 Set a field's value, removing any old values.
44
45 -s field+=value / --set field+=value
46 Add an additional value, preserving any old values.
47
48 -s field?=value / --set field?=value
49 Set a value, but only if the field does not already have a value
50 set.
51
52 -s field-=value / --set field-=value
53 Remove a value from a field, leaving any other values that the
54 field has set.
55
56 -r field / --remove field
57 Remove all current values of the field.
58
59 -t tag / --tag tag
60 Set a tag. Note that a tag is just a value of the "tag" field.
61
62 -u tag / --unset tag
63 Unset a tag.
64
65 --remove-all
66 Remove all metadata from the specified files.
67
68 When a file is modified and the new version added, git-annex
69 will copy over the metadata from the old version of the file. In
70 situations where you don't want that copied metadata, you can
71 use this option to remove it.
72
73 --force
74 By default, git annex metadata refuses to recursively set meta‐
75 data throughout the files in a directory. This option enables
76 such recursive setting.
77
78 matching options
79 The git-annex-matching-options(1) can be used to control what to
80 act on.
81
82 --all -A
83 Specify instead of a file to get/set metadata on all known keys.
84
85 --branch=ref
86 Specify instead of a file to get/set metadata on all files in
87 the specified branch or treeish.
88
89 --unused
90 Specify instead of a file to get/set metadata on files found by
91 last run of git-annex unused.
92
93 --key=keyname
94 Specify instead of a file to get/set metadata of the specified
95 key.
96
97 --json Enable JSON output (and input). Each line is a JSON object.
98
99 The format of the JSON objects changed in git-annex version
100 6.20160726.
101
102 Example of the new format:
103
104 {"command":"metadata","file":"foo","key":"...","fields":{"au‐
105 thor":["bar"],...},"note":"...","success":true}
106
107 Example of the old format, which lacks the inner fields object:
108
109 {"command":"metadata","file":"foo","key":"...","au‐
110 thor":["bar"],...,"note":"...","success":true}
111
112 --json-error-messages
113 Messages that would normally be output to standard error are in‐
114 cluded in the JSON instead.
115
116 --batch
117 Enables batch mode, which can be used to both get, store, and
118 unset metadata for multiple files or keys.
119
120 Batch currently only supports JSON input. So, you must enable
121 --json along with --batch.
122
123 In batch mode, git-annex reads lines from stdin, which contain
124 JSON objects. It replies to each input annexed file with an out‐
125 put JSON object. (But if the file is not an annexed file, an
126 empty line will be output.)
127
128 The format of the JSON sent to git-annex can be the same as the
129 JSON that it outputs. Or, a simplified version. Only the "file"
130 (or "key") field is actually necessary.
131
132 For example, to get the current metadata of file foo:
133
134 {"file":"foo"}
135
136 To get the current metadata of the key k:
137
138 {"key":"k"}
139
140 Any metadata fields included in the JSON object will be stored,
141 replacing whatever values the fields had before. To unset a
142 field, include it with an empty list of values.
143
144 To change the author of file foo to bar:
145
146 {"file":"foo","fields":{"author":["bar"]}}
147
148 To remove the author of file foo:
149
150 {"file":"foo","fields":{"author":[]}}
151
152 Also the git-annex-common-options(1) can be used.
153
155 To set some tags on a file and also its author:
156
157 git annex metadata annexscreencast.ogv -t video -t screencast -s au‐
158 thor+=Alice
159
161 git-annex(1)
162
163 git-annex-view(1)
164
166 Joey Hess <id@joeyh.name>
167
168 git-annex-metadata(1)