1git-annex-metadata(1)       General Commands Manual      git-annex-metadata(1)
2
3
4

NAME

6       git-annex-metadata - sets or gets metadata of a file
7

SYNOPSIS

9       git annex metadata [path ...]
10

DESCRIPTION

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 the particular content of a file,
28       not  to  a  particular  filename on a particular git branch.  More pre‐
29       cisely, metadata is attached to the key used for the  file,  which  can
30       reflect  file  contents and/or name, depending on the key-value backend
31       used for the file.  All files with the same key share  the  same  meta‐
32       data, which is stored in the git-annex branch. If a file is edited, old
33       metadata will be copied to the  new  key  when  you  git-annex-add  the
34       edited  file.   Note  also  that changes to a file's git-annex metadata
35       will not be reflected in the git log of the file, since they are stored
36       on  the  git-annex  branch.  To  attach  metadata to a particular path,
37       rather than a particular key, use .gitattributes .
38

OPTIONS

40       -g field / --get field
41
42              Get the value(s) of a single field.
43
44              The values will be output one per line, with no other output, so
45              this is suitable for use in a script.
46
47       -s field=value / --set field=value
48              Set a field's value, removing any old values.
49
50       -s field+=value / --set field+=value
51              Add an additional value, preserving any old values.
52
53       -s field?=value / --set field?=value
54              Set a value, but only if the field does not already have a value
55              set.
56
57       -s field-=value / --set field-=value
58              Remove a value from a field, leaving any other values  that  the
59              field has set.
60
61       -r field / --remove field
62              Remove all current values of the field.
63
64       -t tag / --tag tag
65              Set a tag. Note that a tag is just a value of the "tag" field.
66
67       -u tag / --unset tag
68              Unset a tag.
69
70       --remove-all
71              Remove all metadata from the specified files.
72
73              When  a  file  is  modified and the new version added, git-annex
74              will copy over the metadata from the old version of the file. In
75              situations  where  you  don't want that copied metadata, you can
76              use this option to remove it.
77
78       --force
79              By default, git annex metadata refuses to recursively set  meta‐
80              data  throughout  the  files in a directory. This option enables
81              such recursive setting.
82
83       file matching options
84              The git-annex-matching-options(1) can be used to  specify  files
85              to act on.
86
87       --all -A
88              Specify instead of a file to get/set metadata on all known keys.
89
90       --branch=ref
91              Specify  instead  of  a file to get/set metadata on all files in
92              the specified branch or treeish.
93
94       --unused
95              Specify instead of a file to get/set metadata on files found  by
96              last run of git-annex unused.
97
98       --key=keyname
99              Specify  instead  of a file to get/set metadata of the specified
100              key.
101
102       --json Enable JSON output (and input). Each line is a JSON object.
103
104              The format of the JSON  objects  changed  in  git-annex  version
105              6.20160726.
106
107              Example of the new format:
108
109               {"command":"meta‐
110              data","file":"foo","key":"...","fields":{"author":["bar"],...},"note":"...","suc‐
111              cess":true}
112
113              Example of the old format, which lacks the inner fields object:
114
115               {"command":"meta‐
116              data","file":"foo","key":"...","author":["bar"],...,"note":"...","suc‐
117              cess":true}
118
119       --json-error-messages
120              Messages  that  would  normally  be output to standard error are
121              included in the json instead.
122
123       --batch
124              Enables batch mode, which can be used to both  get,  store,  and
125              unset metadata for multiple files or keys.
126
127              Batch  currently  only  supports JSON input. So, you must enable
128              --json along with --batch.
129
130              In batch mode, git-annex reads lines from stdin,  which  contain
131              JSON  objects.  It  replies  to  each  input with an output JSON
132              object.
133
134              The format of the JSON sent to git-annex can be the same as  the
135              JSON  that it outputs. Or, a simplified version. Only the "file"
136              (or "key") field is actually necessary.
137
138              For example, to get the current metadata of file foo:
139
140               {"file":"foo"}
141
142              To get the current metadata of the key k:
143
144               {"key":"k"}
145
146              Any metadata fields included in the JSON object will be  stored,
147              replacing  whatever  values  the  fields had before.  To unset a
148              field, include it with an empty list of values.
149
150              To change the author of file foo to bar:
151
152               {"file":"foo","fields":{"author":["bar"]}}
153
154              To remove the author of file foo:
155
156               {"file":"foo","fields":{"author":[]}}
157
158              Note that file matching options do not affect the files that are
159              processed when in batch mode.
160

EXAMPLES

162       To set some tags on a file and also its author:
163
164        git  annex  metadata  annexscreencast.ogv  -t  video  -t screencast -s
165       author+=Alice
166

SEE ALSO

168       git-annex(1)
169
170       git-annex-view(1)
171

AUTHOR

173       Joey Hess <id@joeyh.name>
174
175                                                         git-annex-metadata(1)
Impressum