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 file matching options
79 The git-annex-matching-options(1) can be used to specify files
80 to 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":"meta‐
105 data","file":"foo","key":"...","fields":{"author":["bar"],...},"note":"...","suc‐
106 cess":true}
107
108 Example of the old format, which lacks the inner fields object:
109
110 {"command":"meta‐
111 data","file":"foo","key":"...","author":["bar"],...,"note":"...","suc‐
112 cess":true}
113
114 --json-error-messages
115 Messages that would normally be output to standard error are
116 included in the json instead.
117
118 --batch
119 Enables batch mode, which can be used to both get, store, and
120 unset metadata for multiple files or keys.
121
122 Batch currently only supports JSON input. So, you must enable
123 --json along with --batch.
124
125 In batch mode, git-annex reads lines from stdin, which contain
126 JSON objects. It replies to each input with an output JSON
127 object.
128
129 The format of the JSON sent to git-annex can be the same as the
130 JSON that it outputs. Or, a simplified version. Only the "file"
131 (or "key") field is actually necessary.
132
133 For example, to get the current metadata of file foo:
134
135 {"file":"foo"}
136
137 To get the current metadata of the key k:
138
139 {"key":"k"}
140
141 Any metadata fields included in the JSON object will be stored,
142 replacing whatever values the fields had before. To unset a
143 field, include it with an empty list of values.
144
145 To change the author of file foo to bar:
146
147 {"file":"foo","fields":{"author":["bar"]}}
148
149 To remove the author of file foo:
150
151 {"file":"foo","fields":{"author":[]}}
152
153 Note that file matching options do not affect the files that are
154 processed when in batch mode.
155
157 To set some tags on a file and also its author:
158
159 git annex metadata annexscreencast.ogv -t video -t screencast -s
160 author+=Alice
161
163 git-annex(1)
164
165 git-annex-view(1)
166
168 Joey Hess <id@joeyh.name>
169
170 git-annex-metadata(1)