1GIT-FAST-EXPORT(1) Git Manual GIT-FAST-EXPORT(1)
2
3
4
6 git-fast-export - Git data exporter
7
9 git fast-export [<options>] | git fast-import
10
12 This program dumps the given revisions in a form suitable to be piped
13 into git fast-import.
14
15 You can use it as a human-readable bundle replacement (see git-
16 bundle(1)), or as a format that can be edited before being fed to git
17 fast-import in order to do history rewrites (an ability relied on by
18 tools like git filter-repo).
19
21 --progress=<n>
22 Insert progress statements every <n> objects, to be shown by git
23 fast-import during import.
24
25 --signed-tags=(verbatim|warn|warn-strip|strip|abort)
26 Specify how to handle signed tags. Since any transformation after
27 the export can change the tag names (which can also happen when
28 excluding revisions) the signatures will not match.
29
30 When asking to abort (which is the default), this program will die
31 when encountering a signed tag. With strip, the tags will silently
32 be made unsigned, with warn-strip they will be made unsigned but a
33 warning will be displayed, with verbatim, they will be silently
34 exported and with warn, they will be exported, but you will see a
35 warning.
36
37 --tag-of-filtered-object=(abort|drop|rewrite)
38 Specify how to handle tags whose tagged object is filtered out.
39 Since revisions and files to export can be limited by path, tagged
40 objects may be filtered completely.
41
42 When asking to abort (which is the default), this program will die
43 when encountering such a tag. With drop it will omit such tags from
44 the output. With rewrite, if the tagged object is a commit, it will
45 rewrite the tag to tag an ancestor commit (via parent rewriting;
46 see git-rev-list(1))
47
48 -M, -C
49 Perform move and/or copy detection, as described in the git-diff(1)
50 manual page, and use it to generate rename and copy commands in the
51 output dump.
52
53 Note that earlier versions of this command did not complain and
54 produced incorrect results if you gave these options.
55
56 --export-marks=<file>
57 Dumps the internal marks table to <file> when complete. Marks are
58 written one per line as :markid SHA-1. Only marks for revisions are
59 dumped; marks for blobs are ignored. Backends can use this file to
60 validate imports after they have been completed, or to save the
61 marks table across incremental runs. As <file> is only opened and
62 truncated at completion, the same path can also be safely given to
63 --import-marks. The file will not be written if no new object has
64 been marked/exported.
65
66 --import-marks=<file>
67 Before processing any input, load the marks specified in <file>.
68 The input file must exist, must be readable, and must use the same
69 format as produced by --export-marks.
70
71 --mark-tags
72 In addition to labelling blobs and commits with mark ids, also
73 label tags. This is useful in conjunction with --export-marks and
74 --import-marks, and is also useful (and necessary) for exporting of
75 nested tags. It does not hurt other cases and would be the default,
76 but many fast-import frontends are not prepared to accept tags with
77 mark identifiers.
78
79 Any commits (or tags) that have already been marked will not be
80 exported again. If the backend uses a similar --import-marks file,
81 this allows for incremental bidirectional exporting of the
82 repository by keeping the marks the same across runs.
83
84 --fake-missing-tagger
85 Some old repositories have tags without a tagger. The fast-import
86 protocol was pretty strict about that, and did not allow that. So
87 fake a tagger to be able to fast-import the output.
88
89 --use-done-feature
90 Start the stream with a feature done stanza, and terminate it with
91 a done command.
92
93 --no-data
94 Skip output of blob objects and instead refer to blobs via their
95 original SHA-1 hash. This is useful when rewriting the directory
96 structure or history of a repository without touching the contents
97 of individual files. Note that the resulting stream can only be
98 used by a repository which already contains the necessary objects.
99
100 --full-tree
101 This option will cause fast-export to issue a "deleteall" directive
102 for each commit followed by a full list of all files in the commit
103 (as opposed to just listing the files which are different from the
104 commit’s first parent).
105
106 --anonymize
107 Anonymize the contents of the repository while still retaining the
108 shape of the history and stored tree. See the section on
109 ANONYMIZING below.
110
111 --anonymize-map=<from>[:<to>]
112 Convert token <from> to <to> in the anonymized output. If <to> is
113 omitted, map <from> to itself (i.e., do not anonymize it). See the
114 section on ANONYMIZING below.
115
116 --reference-excluded-parents
117 By default, running a command such as git fast-export
118 master~5..master will not include the commit master~5 and will make
119 master~4 no longer have master~5 as a parent (though both the old
120 master~4 and new master~4 will have all the same files). Use
121 --reference-excluded-parents to instead have the stream refer to
122 commits in the excluded range of history by their sha1sum. Note
123 that the resulting stream can only be used by a repository which
124 already contains the necessary parent commits.
125
126 --show-original-ids
127 Add an extra directive to the output for commits and blobs,
128 original-oid <SHA1SUM>. While such directives will likely be
129 ignored by importers such as git-fast-import, it may be useful for
130 intermediary filters (e.g. for rewriting commit messages which
131 refer to older commits, or for stripping blobs by id).
132
133 --reencode=(yes|no|abort)
134 Specify how to handle encoding header in commit objects. When
135 asking to abort (which is the default), this program will die when
136 encountering such a commit object. With yes, the commit message
137 will be re-encoded into UTF-8. With no, the original encoding will
138 be preserved.
139
140 --refspec
141 Apply the specified refspec to each ref exported. Multiple of them
142 can be specified.
143
144 [<git-rev-list-args>...]
145 A list of arguments, acceptable to git rev-parse and git rev-list,
146 that specifies the specific objects and references to export. For
147 example, master~10..master causes the current master reference to
148 be exported along with all objects added since its 10th ancestor
149 commit and (unless the --reference-excluded-parents option is
150 specified) all files common to master~9 and master~10.
151
153 $ git fast-export --all | (cd /empty/repository && git fast-import)
154
155 This will export the whole repository and import it into the existing
156 empty repository. Except for reencoding commits that are not in UTF-8,
157 it would be a one-to-one mirror.
158
159 $ git fast-export master~5..master |
160 sed "s|refs/heads/master|refs/heads/other|" |
161 git fast-import
162
163 This makes a new branch called other from master~5..master (i.e. if
164 master has linear history, it will take the last 5 commits).
165
166 Note that this assumes that none of the blobs and commit messages
167 referenced by that revision range contains the string
168 refs/heads/master.
169
171 If the --anonymize option is given, git will attempt to remove all
172 identifying information from the repository while still retaining
173 enough of the original tree and history patterns to reproduce some
174 bugs. The goal is that a git bug which is found on a private repository
175 will persist in the anonymized repository, and the latter can be shared
176 with git developers to help solve the bug.
177
178 With this option, git will replace all refnames, paths, blob contents,
179 commit and tag messages, names, and email addresses in the output with
180 anonymized data. Two instances of the same string will be replaced
181 equivalently (e.g., two commits with the same author will have the same
182 anonymized author in the output, but bear no resemblance to the
183 original author string). The relationship between commits, branches,
184 and tags is retained, as well as the commit timestamps (but the commit
185 messages and refnames bear no resemblance to the originals). The
186 relative makeup of the tree is retained (e.g., if you have a root tree
187 with 10 files and 3 trees, so will the output), but their names and the
188 contents of the files will be replaced.
189
190 If you think you have found a git bug, you can start by exporting an
191 anonymized stream of the whole repository:
192
193 $ git fast-export --anonymize --all >anon-stream
194
195 Then confirm that the bug persists in a repository created from that
196 stream (many bugs will not, as they really do depend on the exact
197 repository contents):
198
199 $ git init anon-repo
200 $ cd anon-repo
201 $ git fast-import <../anon-stream
202 $ ... test your bug ...
203
204 If the anonymized repository shows the bug, it may be worth sharing
205 anon-stream along with a regular bug report. Note that the anonymized
206 stream compresses very well, so gzipping it is encouraged. If you want
207 to examine the stream to see that it does not contain any private data,
208 you can peruse it directly before sending. You may also want to try:
209
210 $ perl -pe 's/\d+/X/g' <anon-stream | sort -u | less
211
212 which shows all of the unique lines (with numbers converted to "X", to
213 collapse "User 0", "User 1", etc into "User X"). This produces a much
214 smaller output, and it is usually easy to quickly confirm that there is
215 no private data in the stream.
216
217 Reproducing some bugs may require referencing particular commits or
218 paths, which becomes challenging after refnames and paths have been
219 anonymized. You can ask for a particular token to be left as-is or
220 mapped to a new value. For example, if you have a bug which reproduces
221 with git rev-list sensitive -- secret.c, you can run:
222
223 $ git fast-export --anonymize --all \
224 --anonymize-map=sensitive:foo \
225 --anonymize-map=secret.c:bar.c \
226 >stream
227
228 After importing the stream, you can then run git rev-list foo -- bar.c
229 in the anonymized repository.
230
231 Note that paths and refnames are split into tokens at slash boundaries.
232 The command above would anonymize subdir/secret.c as something like
233 path123/bar.c; you could then search for bar.c in the anonymized
234 repository to determine the final pathname.
235
236 To make referencing the final pathname simpler, you can map each path
237 component; so if you also anonymize subdir to publicdir, then the final
238 pathname would be publicdir/bar.c.
239
241 Since git fast-import cannot tag trees, you will not be able to export
242 the linux.git repository completely, as it contains a tag referencing a
243 tree instead of a commit.
244
246 git-fast-import(1)
247
249 Part of the git(1) suite
250
251
252
253Git 2.31.1 2021-03-26 GIT-FAST-EXPORT(1)