1git-annex-export(1) General Commands Manual git-annex-export(1)
2
3
4
6 git-annex-export - export a tree of files to a special remote
7
9 git annex export treeish --to remote
10
12 Use this command to export a tree of files from a git-annex repository.
13
14 Normally files are stored on a git-annex special remote named by their
15 keys. That is great for reliable data storage, but your filenames are
16 obscured. Exporting replicates the tree to the special remote as-is.
17
18 Mixing key/value storage and exports in the same remote would be a mess
19 and so is not allowed. You have to configure a special remote with ex‐
20 porttree=yes when initially setting it up with git-annex-initremote(1).
21
22 The treeish to export can be the name of a git branch, or a tag, or any
23 other treeish accepted by git, including eg master:subdir to only ex‐
24 port a subdirectory from a branch.
25
26 When the remote has a preferred content expression set by git-an‐
27 nex-wanted(1), the treeish is filtered through it, excluding annexed
28 files it does not want from being exported to it. (Note that things in
29 the expression like "include=" match relative to the top of the treeish
30 being exported.)
31
32 Any files in the treeish that are stored on git will also be exported
33 to the special remote.
34
35 Repeated exports are done efficiently, by diffing the old and new tree,
36 and transferring only the changed files, and renaming files as neces‐
37 sary.
38
39 Exports can be interrupted and resumed. However, partially uploaded
40 files will be re-started from the beginning in most cases.
41
42 Once content has been exported to a remote, commands like git annex get
43 can download content from there the same as from other remotes. How‐
44 ever, since an export is not a key/value store, git-annex has to do
45 more verification of content downloaded from an export. Some types of
46 keys, that are not based on checksums, cannot be downloaded from an ex‐
47 port. And, git-annex will never trust an export to retain the content
48 of a key.
49
50 However, some special remotes, notably S3, support keeping track of old
51 versions of files stored in them. If a special remote is set up to do
52 that, it can be used as a key/value store and the limitations in the
53 above paragraph do not apply. Note that dropping content from such a
54 remote is not supported. See individual special remotes' documentation
55 for details of how to enable such versioning.
56
57 The git annex sync --content command (and the git-annex assistant) can
58 also be used to export a branch to a special remote, updating the spe‐
59 cial remote whenever the branch is changed. To do this, you need to
60 configure "remote.<name>.annex-tracking-branch" to tell it what branch
61 to track. For example:
62
63 git config remote.myremote.annex-tracking-branch master
64 git annex sync --content
65
66 You can combine using git annex export to send changes to a special re‐
67 mote with git annex import to fetch changes from a special remote.
68 When a file on a special remote has been modified by software other
69 than git-annex, exporting to it will not overwrite the modified file,
70 and the export will not succeed. You can resolve this conflict by using
71 git annex import.
72
73 (Some types of special remotes such as S3 with versioning may instead
74 let an export overwrite the modified file; then git annex import will
75 create a sequence of commits that includes the modified file, so the
76 overwritten modification is not lost.)
77
79 --to=remote
80
81 Specify the special remote to export to.
82
83 --tracking
84 This is a deprecated way to set "remote.<name>.annex-track‐
85 ing-branch". Instead of using this option, you should just set
86 the git configuration yourself.
87
88 --fast This sets up an export of a tree, but avoids any expensive file
89 uploads to the remote. You can later run git annex sync --con‐
90 tent to upload the files to the export.
91
92 --jobs=N -JN
93 Exports multiple files in parallel. This may be faster. For ex‐
94 ample: -J4
95
96 Setting this to "cpus" will run one job per CPU core.
97
98 --json Enable JSON output. This is intended to be parsed by programs
99 that use git-annex. Each line of output is a JSON object.
100
101 --json-progress
102 Include progress objects in JSON output.
103
104 --json-error-messages
105 Messages that would normally be output to standard error are in‐
106 cluded in the json instead.
107
108 Also the git-annex-common-options(1) can be used.
109
111 git annex initremote myremote type=directory directory=/mnt/myremote
112 exporttree=yes encryption=none
113 git annex export master --to myremote
114
115 After that, /mnt/myremote will contain the same tree of files as the
116 master branch does.
117
118 git mv myfile subdir/myfile
119 git commit -m renamed
120 git annex export master --to myremote
121
122 That updates /mnt/myremote to reflect the renamed file.
123
124 git annex export master:subdir --to myremote
125
126 That updates /mnt/myremote, to contain only the files in the "subdir"
127 directory of the master branch.
128
130 If two different git-annex repositories are both exporting different
131 trees to the same special remote, it's possible for an export conflict
132 to occur. This leaves the special remote with some files from one
133 tree, and some files from the other. Files in the special remote may
134 have entirely the wrong content as well.
135
136 It's not possible for git-annex to detect when making an export will
137 result in an export conflict. The best way to avoid export conflicts is
138 to either only ever export to a special remote from a single reposi‐
139 tory, or to have a rule about the tree that you export to the special
140 remote. For example, if you always export origin/master after pushing
141 to origin, then an export conflict can't happen.
142
143 An export conflict can only be detected after the two git repositories
144 that produced it get back in sync. Then the next time you run git annex
145 export, it will detect the export conflict, and resolve it.
146
148 git-annex(1)
149
150 git-annex-initremote(1)
151
152 git-annex-import(1)
153
154 git-annex-sync(1)
155
156 git-annex-preferred-content(1)
157
159 The export command was introduced in git-annex version 6.20170925.
160
162 Joey Hess <id@joeyh.name>
163
164 git-annex-export(1)