Autogenerated HTML docs for v1.7.5-185-g0b9dee
[git/jnareb-git.git] / git-fast-import.html
blob0697ca14b2fcea69e766d4544fa7449110239af7
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.4.5" />
7 <title>git-fast-import(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-fast-import(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-fast-import -
411 Backend for fast Git data importers
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="paragraph"><p>frontend | <em>git fast-import</em> [options]</p></div>
418 </div>
419 <h2 id="_description">DESCRIPTION</h2>
420 <div class="sectionbody">
421 <div class="paragraph"><p>This program is usually not what the end user wants to run directly.
422 Most end users want to use one of the existing frontend programs,
423 which parses a specific type of foreign source and feeds the contents
424 stored there to <em>git fast-import</em>.</p></div>
425 <div class="paragraph"><p>fast-import reads a mixed command/data stream from standard input and
426 writes one or more packfiles directly into the current repository.
427 When EOF is received on standard input, fast import writes out
428 updated branch and tag refs, fully updating the current repository
429 with the newly imported data.</p></div>
430 <div class="paragraph"><p>The fast-import backend itself can import into an empty repository (one that
431 has already been initialized by <em>git init</em>) or incrementally
432 update an existing populated repository. Whether or not incremental
433 imports are supported from a particular foreign source depends on
434 the frontend program in use.</p></div>
435 </div>
436 <h2 id="_options">OPTIONS</h2>
437 <div class="sectionbody">
438 <div class="dlist"><dl>
439 <dt class="hdlist1">
440 --date-format=&lt;fmt&gt;
441 </dt>
442 <dd>
444 Specify the type of dates the frontend will supply to
445 fast-import within <tt>author</tt>, <tt>committer</tt> and <tt>tagger</tt> commands.
446 See &#8220;Date Formats&#8221; below for details about which formats
447 are supported, and their syntax.
448 </p>
449 </dd>
450 <dt class="hdlist1">
451 --force
452 </dt>
453 <dd>
455 Force updating modified existing branches, even if doing
456 so would cause commits to be lost (as the new commit does
457 not contain the old commit).
458 </p>
459 </dd>
460 <dt class="hdlist1">
461 --max-pack-size=&lt;n&gt;
462 </dt>
463 <dd>
465 Maximum size of each output packfile.
466 The default is unlimited.
467 </p>
468 </dd>
469 <dt class="hdlist1">
470 --big-file-threshold=&lt;n&gt;
471 </dt>
472 <dd>
474 Maximum size of a blob that fast-import will attempt to
475 create a delta for, expressed in bytes. The default is 512m
476 (512 MiB). Some importers may wish to lower this on systems
477 with constrained memory.
478 </p>
479 </dd>
480 <dt class="hdlist1">
481 --depth=&lt;n&gt;
482 </dt>
483 <dd>
485 Maximum delta depth, for blob and tree deltification.
486 Default is 10.
487 </p>
488 </dd>
489 <dt class="hdlist1">
490 --active-branches=&lt;n&gt;
491 </dt>
492 <dd>
494 Maximum number of branches to maintain active at once.
495 See &#8220;Memory Utilization&#8221; below for details. Default is 5.
496 </p>
497 </dd>
498 <dt class="hdlist1">
499 --export-marks=&lt;file&gt;
500 </dt>
501 <dd>
503 Dumps the internal marks table to &lt;file&gt; when complete.
504 Marks are written one per line as <tt>:markid SHA-1</tt>.
505 Frontends can use this file to validate imports after they
506 have been completed, or to save the marks table across
507 incremental runs. As &lt;file&gt; is only opened and truncated
508 at checkpoint (or completion) the same path can also be
509 safely given to --import-marks.
510 </p>
511 </dd>
512 <dt class="hdlist1">
513 --import-marks=&lt;file&gt;
514 </dt>
515 <dd>
517 Before processing any input, load the marks specified in
518 &lt;file&gt;. The input file must exist, must be readable, and
519 must use the same format as produced by --export-marks.
520 Multiple options may be supplied to import more than one
521 set of marks. If a mark is defined to different values,
522 the last file wins.
523 </p>
524 </dd>
525 <dt class="hdlist1">
526 --import-marks-if-exists=&lt;file&gt;
527 </dt>
528 <dd>
530 Like --import-marks but instead of erroring out, silently
531 skips the file if it does not exist.
532 </p>
533 </dd>
534 <dt class="hdlist1">
535 --relative-marks
536 </dt>
537 <dd>
539 After specifying --relative-marks= the paths specified
540 with --import-marks= and --export-marks= are relative
541 to an internal directory in the current repository.
542 In git-fast-import this means that the paths are relative
543 to the .git/info/fast-import directory. However, other
544 importers may use a different location.
545 </p>
546 </dd>
547 <dt class="hdlist1">
548 --no-relative-marks
549 </dt>
550 <dd>
552 Negates a previous --relative-marks. Allows for combining
553 relative and non-relative marks by interweaving
554 --(no-)-relative-marks= with the --(import|export)-marks=
555 options.
556 </p>
557 </dd>
558 <dt class="hdlist1">
559 --cat-blob-fd=&lt;fd&gt;
560 </dt>
561 <dd>
563 Specify the file descriptor that will be written to
564 when the <tt>cat-blob</tt> command is encountered in the stream.
565 The default behaviour is to write to <tt>stdout</tt>.
566 </p>
567 </dd>
568 <dt class="hdlist1">
569 --export-pack-edges=&lt;file&gt;
570 </dt>
571 <dd>
573 After creating a packfile, print a line of data to
574 &lt;file&gt; listing the filename of the packfile and the last
575 commit on each branch that was written to that packfile.
576 This information may be useful after importing projects
577 whose total object set exceeds the 4 GiB packfile limit,
578 as these commits can be used as edge points during calls
579 to <em>git pack-objects</em>.
580 </p>
581 </dd>
582 <dt class="hdlist1">
583 --quiet
584 </dt>
585 <dd>
587 Disable all non-fatal output, making fast-import silent when it
588 is successful. This option disables the output shown by
589 --stats.
590 </p>
591 </dd>
592 <dt class="hdlist1">
593 --stats
594 </dt>
595 <dd>
597 Display some basic statistics about the objects fast-import has
598 created, the packfiles they were stored into, and the
599 memory used by fast-import during this run. Showing this output
600 is currently the default, but can be disabled with --quiet.
601 </p>
602 </dd>
603 </dl></div>
604 </div>
605 <h2 id="_performance">Performance</h2>
606 <div class="sectionbody">
607 <div class="paragraph"><p>The design of fast-import allows it to import large projects in a minimum
608 amount of memory usage and processing time. Assuming the frontend
609 is able to keep up with fast-import and feed it a constant stream of data,
610 import times for projects holding 10+ years of history and containing
611 100,000+ individual commits are generally completed in just 1-2
612 hours on quite modest (~$2,000 USD) hardware.</p></div>
613 <div class="paragraph"><p>Most bottlenecks appear to be in foreign source data access (the
614 source just cannot extract revisions fast enough) or disk IO (fast-import
615 writes as fast as the disk will take the data). Imports will run
616 faster if the source data is stored on a different drive than the
617 destination Git repository (due to less IO contention).</p></div>
618 </div>
619 <h2 id="_development_cost">Development Cost</h2>
620 <div class="sectionbody">
621 <div class="paragraph"><p>A typical frontend for fast-import tends to weigh in at approximately 200
622 lines of Perl/Python/Ruby code. Most developers have been able to
623 create working importers in just a couple of hours, even though it
624 is their first exposure to fast-import, and sometimes even to Git. This is
625 an ideal situation, given that most conversion tools are throw-away
626 (use once, and never look back).</p></div>
627 </div>
628 <h2 id="_parallel_operation">Parallel Operation</h2>
629 <div class="sectionbody">
630 <div class="paragraph"><p>Like <em>git push</em> or <em>git fetch</em>, imports handled by fast-import are safe to
631 run alongside parallel <tt>git repack -a -d</tt> or <tt>git gc</tt> invocations,
632 or any other Git operation (including <em>git prune</em>, as loose objects
633 are never used by fast-import).</p></div>
634 <div class="paragraph"><p>fast-import does not lock the branch or tag refs it is actively importing.
635 After the import, during its ref update phase, fast-import tests each
636 existing branch ref to verify the update will be a fast-forward
637 update (the commit stored in the ref is contained in the new
638 history of the commit to be written). If the update is not a
639 fast-forward update, fast-import will skip updating that ref and instead
640 prints a warning message. fast-import will always attempt to update all
641 branch refs, and does not stop on the first failure.</p></div>
642 <div class="paragraph"><p>Branch updates can be forced with --force, but it&#8217;s recommended that
643 this only be used on an otherwise quiet repository. Using --force
644 is not necessary for an initial import into an empty repository.</p></div>
645 </div>
646 <h2 id="_technical_discussion">Technical Discussion</h2>
647 <div class="sectionbody">
648 <div class="paragraph"><p>fast-import tracks a set of branches in memory. Any branch can be created
649 or modified at any point during the import process by sending a
650 <tt>commit</tt> command on the input stream. This design allows a frontend
651 program to process an unlimited number of branches simultaneously,
652 generating commits in the order they are available from the source
653 data. It also simplifies the frontend programs considerably.</p></div>
654 <div class="paragraph"><p>fast-import does not use or alter the current working directory, or any
655 file within it. (It does however update the current Git repository,
656 as referenced by <tt>GIT_DIR</tt>.) Therefore an import frontend may use
657 the working directory for its own purposes, such as extracting file
658 revisions from the foreign source. This ignorance of the working
659 directory also allows fast-import to run very quickly, as it does not
660 need to perform any costly file update operations when switching
661 between branches.</p></div>
662 </div>
663 <h2 id="_input_format">Input Format</h2>
664 <div class="sectionbody">
665 <div class="paragraph"><p>With the exception of raw file data (which Git does not interpret)
666 the fast-import input format is text (ASCII) based. This text based
667 format simplifies development and debugging of frontend programs,
668 especially when a higher level language such as Perl, Python or
669 Ruby is being used.</p></div>
670 <div class="paragraph"><p>fast-import is very strict about its input. Where we say SP below we mean
671 <strong>exactly</strong> one space. Likewise LF means one (and only one) linefeed
672 and HT one (and only one) horizontal tab.
673 Supplying additional whitespace characters will cause unexpected
674 results, such as branch names or file names with leading or trailing
675 spaces in their name, or early termination of fast-import when it encounters
676 unexpected input.</p></div>
677 <h3 id="_stream_comments">Stream Comments</h3><div style="clear:left"></div>
678 <div class="paragraph"><p>To aid in debugging frontends fast-import ignores any line that
679 begins with <tt>#</tt> (ASCII pound/hash) up to and including the line
680 ending <tt>LF</tt>. A comment line may contain any sequence of bytes
681 that does not contain an LF and therefore may be used to include
682 any detailed debugging information that might be specific to the
683 frontend and useful when inspecting a fast-import data stream.</p></div>
684 <h3 id="_date_formats">Date Formats</h3><div style="clear:left"></div>
685 <div class="paragraph"><p>The following date formats are supported. A frontend should select
686 the format it will use for this import by passing the format name
687 in the --date-format=&lt;fmt&gt; command line option.</p></div>
688 <div class="dlist"><dl>
689 <dt class="hdlist1">
690 <tt>raw</tt>
691 </dt>
692 <dd>
694 This is the Git native format and is <tt>&lt;time&gt; SP &lt;offutc&gt;</tt>.
695 It is also fast-import&#8217;s default format, if --date-format was
696 not specified.
697 </p>
698 <div class="paragraph"><p>The time of the event is specified by <tt>&lt;time&gt;</tt> as the number of
699 seconds since the UNIX epoch (midnight, Jan 1, 1970, UTC) and is
700 written as an ASCII decimal integer.</p></div>
701 <div class="paragraph"><p>The local offset is specified by <tt>&lt;offutc&gt;</tt> as a positive or negative
702 offset from UTC. For example EST (which is 5 hours behind UTC)
703 would be expressed in <tt>&lt;tz&gt;</tt> by &#8220;-0500&#8221; while UTC is &#8220;+0000&#8221;.
704 The local offset does not affect <tt>&lt;time&gt;</tt>; it is used only as an
705 advisement to help formatting routines display the timestamp.</p></div>
706 <div class="paragraph"><p>If the local offset is not available in the source material, use
707 &#8220;+0000&#8221;, or the most common local offset. For example many
708 organizations have a CVS repository which has only ever been accessed
709 by users who are located in the same location and timezone. In this
710 case a reasonable offset from UTC could be assumed.</p></div>
711 <div class="paragraph"><p>Unlike the <tt>rfc2822</tt> format, this format is very strict. Any
712 variation in formatting will cause fast-import to reject the value.</p></div>
713 </dd>
714 <dt class="hdlist1">
715 <tt>rfc2822</tt>
716 </dt>
717 <dd>
719 This is the standard email format as described by RFC 2822.
720 </p>
721 <div class="paragraph"><p>An example value is &#8220;Tue Feb 6 11:22:18 2007 -0500&#8221;. The Git
722 parser is accurate, but a little on the lenient side. It is the
723 same parser used by <em>git am</em> when applying patches
724 received from email.</p></div>
725 <div class="paragraph"><p>Some malformed strings may be accepted as valid dates. In some of
726 these cases Git will still be able to obtain the correct date from
727 the malformed string. There are also some types of malformed
728 strings which Git will parse wrong, and yet consider valid.
729 Seriously malformed strings will be rejected.</p></div>
730 <div class="paragraph"><p>Unlike the <tt>raw</tt> format above, the timezone/UTC offset information
731 contained in an RFC 2822 date string is used to adjust the date
732 value to UTC prior to storage. Therefore it is important that
733 this information be as accurate as possible.</p></div>
734 <div class="paragraph"><p>If the source material uses RFC 2822 style dates,
735 the frontend should let fast-import handle the parsing and conversion
736 (rather than attempting to do it itself) as the Git parser has
737 been well tested in the wild.</p></div>
738 <div class="paragraph"><p>Frontends should prefer the <tt>raw</tt> format if the source material
739 already uses UNIX-epoch format, can be coaxed to give dates in that
740 format, or its format is easily convertible to it, as there is no
741 ambiguity in parsing.</p></div>
742 </dd>
743 <dt class="hdlist1">
744 <tt>now</tt>
745 </dt>
746 <dd>
748 Always use the current time and timezone. The literal
749 <tt>now</tt> must always be supplied for <tt>&lt;when&gt;</tt>.
750 </p>
751 <div class="paragraph"><p>This is a toy format. The current time and timezone of this system
752 is always copied into the identity string at the time it is being
753 created by fast-import. There is no way to specify a different time or
754 timezone.</p></div>
755 <div class="paragraph"><p>This particular format is supplied as it&#8217;s short to implement and
756 may be useful to a process that wants to create a new commit
757 right now, without needing to use a working directory or
758 <em>git update-index</em>.</p></div>
759 <div class="paragraph"><p>If separate <tt>author</tt> and <tt>committer</tt> commands are used in a <tt>commit</tt>
760 the timestamps may not match, as the system clock will be polled
761 twice (once for each command). The only way to ensure that both
762 author and committer identity information has the same timestamp
763 is to omit <tt>author</tt> (thus copying from <tt>committer</tt>) or to use a
764 date format other than <tt>now</tt>.</p></div>
765 </dd>
766 </dl></div>
767 <h3 id="_commands">Commands</h3><div style="clear:left"></div>
768 <div class="paragraph"><p>fast-import accepts several commands to update the current repository
769 and control the current import process. More detailed discussion
770 (with examples) of each command follows later.</p></div>
771 <div class="dlist"><dl>
772 <dt class="hdlist1">
773 <tt>commit</tt>
774 </dt>
775 <dd>
777 Creates a new branch or updates an existing branch by
778 creating a new commit and updating the branch to point at
779 the newly created commit.
780 </p>
781 </dd>
782 <dt class="hdlist1">
783 <tt>tag</tt>
784 </dt>
785 <dd>
787 Creates an annotated tag object from an existing commit or
788 branch. Lightweight tags are not supported by this command,
789 as they are not recommended for recording meaningful points
790 in time.
791 </p>
792 </dd>
793 <dt class="hdlist1">
794 <tt>reset</tt>
795 </dt>
796 <dd>
798 Reset an existing branch (or a new branch) to a specific
799 revision. This command must be used to change a branch to
800 a specific revision without making a commit on it.
801 </p>
802 </dd>
803 <dt class="hdlist1">
804 <tt>blob</tt>
805 </dt>
806 <dd>
808 Convert raw file data into a blob, for future use in a
809 <tt>commit</tt> command. This command is optional and is not
810 needed to perform an import.
811 </p>
812 </dd>
813 <dt class="hdlist1">
814 <tt>checkpoint</tt>
815 </dt>
816 <dd>
818 Forces fast-import to close the current packfile, generate its
819 unique SHA-1 checksum and index, and start a new packfile.
820 This command is optional and is not needed to perform
821 an import.
822 </p>
823 </dd>
824 <dt class="hdlist1">
825 <tt>progress</tt>
826 </dt>
827 <dd>
829 Causes fast-import to echo the entire line to its own
830 standard output. This command is optional and is not needed
831 to perform an import.
832 </p>
833 </dd>
834 <dt class="hdlist1">
835 <tt>cat-blob</tt>
836 </dt>
837 <dd>
839 Causes fast-import to print a blob in <em>cat-file --batch</em>
840 format to the file descriptor set with <tt>--cat-blob-fd</tt> or
841 <tt>stdout</tt> if unspecified.
842 </p>
843 </dd>
844 <dt class="hdlist1">
845 <tt>ls</tt>
846 </dt>
847 <dd>
849 Causes fast-import to print a line describing a directory
850 entry in <em>ls-tree</em> format to the file descriptor set with
851 <tt>--cat-blob-fd</tt> or <tt>stdout</tt> if unspecified.
852 </p>
853 </dd>
854 <dt class="hdlist1">
855 <tt>feature</tt>
856 </dt>
857 <dd>
859 Require that fast-import supports the specified feature, or
860 abort if it does not.
861 </p>
862 </dd>
863 <dt class="hdlist1">
864 <tt>option</tt>
865 </dt>
866 <dd>
868 Specify any of the options listed under OPTIONS that do not
869 change stream semantic to suit the frontend&#8217;s needs. This
870 command is optional and is not needed to perform an import.
871 </p>
872 </dd>
873 </dl></div>
874 <h3 id="_tt_commit_tt"><tt>commit</tt></h3><div style="clear:left"></div>
875 <div class="paragraph"><p>Create or update a branch with a new commit, recording one logical
876 change to the project.</p></div>
877 <div class="literalblock">
878 <div class="content">
879 <pre><tt> 'commit' SP &lt;ref&gt; LF
880 mark?
881 ('author' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF)?
882 'committer' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF
883 data
884 ('from' SP &lt;committish&gt; LF)?
885 ('merge' SP &lt;committish&gt; LF)?
886 (filemodify | filedelete | filecopy | filerename | filedeleteall | notemodify)*
887 LF?</tt></pre>
888 </div></div>
889 <div class="paragraph"><p>where <tt>&lt;ref&gt;</tt> is the name of the branch to make the commit on.
890 Typically branch names are prefixed with <tt>refs/heads/</tt> in
891 Git, so importing the CVS branch symbol <tt>RELENG-1_0</tt> would use
892 <tt>refs/heads/RELENG-1_0</tt> for the value of <tt>&lt;ref&gt;</tt>. The value of
893 <tt>&lt;ref&gt;</tt> must be a valid refname in Git. As <tt>LF</tt> is not valid in
894 a Git refname, no quoting or escaping syntax is supported here.</p></div>
895 <div class="paragraph"><p>A <tt>mark</tt> command may optionally appear, requesting fast-import to save a
896 reference to the newly created commit for future use by the frontend
897 (see below for format). It is very common for frontends to mark
898 every commit they create, thereby allowing future branch creation
899 from any imported commit.</p></div>
900 <div class="paragraph"><p>The <tt>data</tt> command following <tt>committer</tt> must supply the commit
901 message (see below for <tt>data</tt> command syntax). To import an empty
902 commit message use a 0 length data. Commit messages are free-form
903 and are not interpreted by Git. Currently they must be encoded in
904 UTF-8, as fast-import does not permit other encodings to be specified.</p></div>
905 <div class="paragraph"><p>Zero or more <tt>filemodify</tt>, <tt>filedelete</tt>, <tt>filecopy</tt>, <tt>filerename</tt>,
906 <tt>filedeleteall</tt> and <tt>notemodify</tt> commands
907 may be included to update the contents of the branch prior to
908 creating the commit. These commands may be supplied in any order.
909 However it is recommended that a <tt>filedeleteall</tt> command precede
910 all <tt>filemodify</tt>, <tt>filecopy</tt>, <tt>filerename</tt> and <tt>notemodify</tt> commands in
911 the same commit, as <tt>filedeleteall</tt> wipes the branch clean (see below).</p></div>
912 <div class="paragraph"><p>The <tt>LF</tt> after the command is optional (it used to be required).</p></div>
913 <h4 id="_tt_author_tt"><tt>author</tt></h4>
914 <div class="paragraph"><p>An <tt>author</tt> command may optionally appear, if the author information
915 might differ from the committer information. If <tt>author</tt> is omitted
916 then fast-import will automatically use the committer&#8217;s information for
917 the author portion of the commit. See below for a description of
918 the fields in <tt>author</tt>, as they are identical to <tt>committer</tt>.</p></div>
919 <h4 id="_tt_committer_tt"><tt>committer</tt></h4>
920 <div class="paragraph"><p>The <tt>committer</tt> command indicates who made this commit, and when
921 they made it.</p></div>
922 <div class="paragraph"><p>Here <tt>&lt;name&gt;</tt> is the person&#8217;s display name (for example
923 &#8220;Com M Itter&#8221;) and <tt>&lt;email&gt;</tt> is the person&#8217;s email address
924 (&#8220;<a href="mailto:cm@example.com">cm@example.com</a>&#8221;). <tt>LT</tt> and <tt>GT</tt> are the literal less-than (\x3c)
925 and greater-than (\x3e) symbols. These are required to delimit
926 the email address from the other fields in the line. Note that
927 <tt>&lt;name&gt;</tt> is free-form and may contain any sequence of bytes, except
928 <tt>LT</tt> and <tt>LF</tt>. It is typically UTF-8 encoded.</p></div>
929 <div class="paragraph"><p>The time of the change is specified by <tt>&lt;when&gt;</tt> using the date format
930 that was selected by the --date-format=&lt;fmt&gt; command line option.
931 See &#8220;Date Formats&#8221; above for the set of supported formats, and
932 their syntax.</p></div>
933 <h4 id="_tt_from_tt"><tt>from</tt></h4>
934 <div class="paragraph"><p>The <tt>from</tt> command is used to specify the commit to initialize
935 this branch from. This revision will be the first ancestor of the
936 new commit.</p></div>
937 <div class="paragraph"><p>Omitting the <tt>from</tt> command in the first commit of a new branch
938 will cause fast-import to create that commit with no ancestor. This
939 tends to be desired only for the initial commit of a project.
940 If the frontend creates all files from scratch when making a new
941 branch, a <tt>merge</tt> command may be used instead of <tt>from</tt> to start
942 the commit with an empty tree.
943 Omitting the <tt>from</tt> command on existing branches is usually desired,
944 as the current commit on that branch is automatically assumed to
945 be the first ancestor of the new commit.</p></div>
946 <div class="paragraph"><p>As <tt>LF</tt> is not valid in a Git refname or SHA-1 expression, no
947 quoting or escaping syntax is supported within <tt>&lt;committish&gt;</tt>.</p></div>
948 <div class="paragraph"><p>Here <tt>&lt;committish&gt;</tt> is any of the following:</p></div>
949 <div class="ulist"><ul>
950 <li>
952 The name of an existing branch already in fast-import&#8217;s internal branch
953 table. If fast-import doesn&#8217;t know the name, it&#8217;s treated as a SHA-1
954 expression.
955 </p>
956 </li>
957 <li>
959 A mark reference, <tt>:&lt;idnum&gt;</tt>, where <tt>&lt;idnum&gt;</tt> is the mark number.
960 </p>
961 <div class="paragraph"><p>The reason fast-import uses <tt>:</tt> to denote a mark reference is this character
962 is not legal in a Git branch name. The leading <tt>:</tt> makes it easy
963 to distinguish between the mark 42 (<tt>:42</tt>) and the branch 42 (<tt>42</tt>
964 or <tt>refs/heads/42</tt>), or an abbreviated SHA-1 which happened to
965 consist only of base-10 digits.</p></div>
966 <div class="paragraph"><p>Marks must be declared (via <tt>mark</tt>) before they can be used.</p></div>
967 </li>
968 <li>
970 A complete 40 byte or abbreviated commit SHA-1 in hex.
971 </p>
972 </li>
973 <li>
975 Any valid Git SHA-1 expression that resolves to a commit. See
976 &#8220;SPECIFYING REVISIONS&#8221; in <a href="gitrevisions.html">gitrevisions(7)</a> for details.
977 </p>
978 </li>
979 </ul></div>
980 <div class="paragraph"><p>The special case of restarting an incremental import from the
981 current branch value should be written as:</p></div>
982 <div class="listingblock">
983 <div class="content">
984 <pre><tt> from refs/heads/branch^0</tt></pre>
985 </div></div>
986 <div class="paragraph"><p>The <tt>&#94;0</tt> suffix is necessary as fast-import does not permit a branch to
987 start from itself, and the branch is created in memory before the
988 <tt>from</tt> command is even read from the input. Adding <tt>&#94;0</tt> will force
989 fast-import to resolve the commit through Git&#8217;s revision parsing library,
990 rather than its internal branch table, thereby loading in the
991 existing value of the branch.</p></div>
992 <h4 id="_tt_merge_tt"><tt>merge</tt></h4>
993 <div class="paragraph"><p>Includes one additional ancestor commit. If the <tt>from</tt> command is
994 omitted when creating a new branch, the first <tt>merge</tt> commit will be
995 the first ancestor of the current commit, and the branch will start
996 out with no files. An unlimited number of <tt>merge</tt> commands per
997 commit are permitted by fast-import, thereby establishing an n-way merge.
998 However Git&#8217;s other tools never create commits with more than 15
999 additional ancestors (forming a 16-way merge). For this reason
1000 it is suggested that frontends do not use more than 15 <tt>merge</tt>
1001 commands per commit; 16, if starting a new, empty branch.</p></div>
1002 <div class="paragraph"><p>Here <tt>&lt;committish&gt;</tt> is any of the commit specification expressions
1003 also accepted by <tt>from</tt> (see above).</p></div>
1004 <h4 id="_tt_filemodify_tt"><tt>filemodify</tt></h4>
1005 <div class="paragraph"><p>Included in a <tt>commit</tt> command to add a new file or change the
1006 content of an existing file. This command has two different means
1007 of specifying the content of the file.</p></div>
1008 <div class="dlist"><dl>
1009 <dt class="hdlist1">
1010 External data format
1011 </dt>
1012 <dd>
1014 The data content for the file was already supplied by a prior
1015 <tt>blob</tt> command. The frontend just needs to connect it.
1016 </p>
1017 <div class="literalblock">
1018 <div class="content">
1019 <pre><tt> 'M' SP &lt;mode&gt; SP &lt;dataref&gt; SP &lt;path&gt; LF</tt></pre>
1020 </div></div>
1021 <div class="paragraph"><p>Here usually <tt>&lt;dataref&gt;</tt> must be either a mark reference (<tt>:&lt;idnum&gt;</tt>)
1022 set by a prior <tt>blob</tt> command, or a full 40-byte SHA-1 of an
1023 existing Git blob object. If <tt>&lt;mode&gt;</tt> is <tt>040000</tt>` then
1024 <tt>&lt;dataref&gt;</tt> must be the full 40-byte SHA-1 of an existing
1025 Git tree object or a mark reference set with <tt>--import-marks</tt>.</p></div>
1026 </dd>
1027 <dt class="hdlist1">
1028 Inline data format
1029 </dt>
1030 <dd>
1032 The data content for the file has not been supplied yet.
1033 The frontend wants to supply it as part of this modify
1034 command.
1035 </p>
1036 <div class="literalblock">
1037 <div class="content">
1038 <pre><tt> 'M' SP &lt;mode&gt; SP 'inline' SP &lt;path&gt; LF
1039 data</tt></pre>
1040 </div></div>
1041 <div class="paragraph"><p>See below for a detailed description of the <tt>data</tt> command.</p></div>
1042 </dd>
1043 </dl></div>
1044 <div class="paragraph"><p>In both formats <tt>&lt;mode&gt;</tt> is the type of file entry, specified
1045 in octal. Git only supports the following modes:</p></div>
1046 <div class="ulist"><ul>
1047 <li>
1049 <tt>100644</tt> or <tt>644</tt>: A normal (not-executable) file. The majority
1050 of files in most projects use this mode. If in doubt, this is
1051 what you want.
1052 </p>
1053 </li>
1054 <li>
1056 <tt>100755</tt> or <tt>755</tt>: A normal, but executable, file.
1057 </p>
1058 </li>
1059 <li>
1061 <tt>120000</tt>: A symlink, the content of the file will be the link target.
1062 </p>
1063 </li>
1064 <li>
1066 <tt>160000</tt>: A gitlink, SHA-1 of the object refers to a commit in
1067 another repository. Git links can only be specified by SHA or through
1068 a commit mark. They are used to implement submodules.
1069 </p>
1070 </li>
1071 <li>
1073 <tt>040000</tt>: A subdirectory. Subdirectories can only be specified by
1074 SHA or through a tree mark set with <tt>--import-marks</tt>.
1075 </p>
1076 </li>
1077 </ul></div>
1078 <div class="paragraph"><p>In both formats <tt>&lt;path&gt;</tt> is the complete path of the file to be added
1079 (if not already existing) or modified (if already existing).</p></div>
1080 <div class="paragraph"><p>A <tt>&lt;path&gt;</tt> string must use UNIX-style directory separators (forward
1081 slash <tt>/</tt>), may contain any byte other than <tt>LF</tt>, and must not
1082 start with double quote (<tt>"</tt>).</p></div>
1083 <div class="paragraph"><p>If an <tt>LF</tt> or double quote must be encoded into <tt>&lt;path&gt;</tt> shell-style
1084 quoting should be used, e.g. <tt>"path/with\n and \" in it"</tt>.</p></div>
1085 <div class="paragraph"><p>The value of <tt>&lt;path&gt;</tt> must be in canonical form. That is it must not:</p></div>
1086 <div class="ulist"><ul>
1087 <li>
1089 contain an empty directory component (e.g. <tt>foo//bar</tt> is invalid),
1090 </p>
1091 </li>
1092 <li>
1094 end with a directory separator (e.g. <tt>foo/</tt> is invalid),
1095 </p>
1096 </li>
1097 <li>
1099 start with a directory separator (e.g. <tt>/foo</tt> is invalid),
1100 </p>
1101 </li>
1102 <li>
1104 contain the special component <tt>.</tt> or <tt>..</tt> (e.g. <tt>foo/./bar</tt> and
1105 <tt>foo/../bar</tt> are invalid).
1106 </p>
1107 </li>
1108 </ul></div>
1109 <div class="paragraph"><p>The root of the tree can be represented by an empty string as <tt>&lt;path&gt;</tt>.</p></div>
1110 <div class="paragraph"><p>It is recommended that <tt>&lt;path&gt;</tt> always be encoded using UTF-8.</p></div>
1111 <h4 id="_tt_filedelete_tt"><tt>filedelete</tt></h4>
1112 <div class="paragraph"><p>Included in a <tt>commit</tt> command to remove a file or recursively
1113 delete an entire directory from the branch. If the file or directory
1114 removal makes its parent directory empty, the parent directory will
1115 be automatically removed too. This cascades up the tree until the
1116 first non-empty directory or the root is reached.</p></div>
1117 <div class="literalblock">
1118 <div class="content">
1119 <pre><tt> 'D' SP &lt;path&gt; LF</tt></pre>
1120 </div></div>
1121 <div class="paragraph"><p>here <tt>&lt;path&gt;</tt> is the complete path of the file or subdirectory to
1122 be removed from the branch.
1123 See <tt>filemodify</tt> above for a detailed description of <tt>&lt;path&gt;</tt>.</p></div>
1124 <h4 id="_tt_filecopy_tt"><tt>filecopy</tt></h4>
1125 <div class="paragraph"><p>Recursively copies an existing file or subdirectory to a different
1126 location within the branch. The existing file or directory must
1127 exist. If the destination exists it will be completely replaced
1128 by the content copied from the source.</p></div>
1129 <div class="literalblock">
1130 <div class="content">
1131 <pre><tt> 'C' SP &lt;path&gt; SP &lt;path&gt; LF</tt></pre>
1132 </div></div>
1133 <div class="paragraph"><p>here the first <tt>&lt;path&gt;</tt> is the source location and the second
1134 <tt>&lt;path&gt;</tt> is the destination. See <tt>filemodify</tt> above for a detailed
1135 description of what <tt>&lt;path&gt;</tt> may look like. To use a source path
1136 that contains SP the path must be quoted.</p></div>
1137 <div class="paragraph"><p>A <tt>filecopy</tt> command takes effect immediately. Once the source
1138 location has been copied to the destination any future commands
1139 applied to the source location will not impact the destination of
1140 the copy.</p></div>
1141 <h4 id="_tt_filerename_tt"><tt>filerename</tt></h4>
1142 <div class="paragraph"><p>Renames an existing file or subdirectory to a different location
1143 within the branch. The existing file or directory must exist. If
1144 the destination exists it will be replaced by the source directory.</p></div>
1145 <div class="literalblock">
1146 <div class="content">
1147 <pre><tt> 'R' SP &lt;path&gt; SP &lt;path&gt; LF</tt></pre>
1148 </div></div>
1149 <div class="paragraph"><p>here the first <tt>&lt;path&gt;</tt> is the source location and the second
1150 <tt>&lt;path&gt;</tt> is the destination. See <tt>filemodify</tt> above for a detailed
1151 description of what <tt>&lt;path&gt;</tt> may look like. To use a source path
1152 that contains SP the path must be quoted.</p></div>
1153 <div class="paragraph"><p>A <tt>filerename</tt> command takes effect immediately. Once the source
1154 location has been renamed to the destination any future commands
1155 applied to the source location will create new files there and not
1156 impact the destination of the rename.</p></div>
1157 <div class="paragraph"><p>Note that a <tt>filerename</tt> is the same as a <tt>filecopy</tt> followed by a
1158 <tt>filedelete</tt> of the source location. There is a slight performance
1159 advantage to using <tt>filerename</tt>, but the advantage is so small
1160 that it is never worth trying to convert a delete/add pair in
1161 source material into a rename for fast-import. This <tt>filerename</tt>
1162 command is provided just to simplify frontends that already have
1163 rename information and don&#8217;t want bother with decomposing it into a
1164 <tt>filecopy</tt> followed by a <tt>filedelete</tt>.</p></div>
1165 <h4 id="_tt_filedeleteall_tt"><tt>filedeleteall</tt></h4>
1166 <div class="paragraph"><p>Included in a <tt>commit</tt> command to remove all files (and also all
1167 directories) from the branch. This command resets the internal
1168 branch structure to have no files in it, allowing the frontend
1169 to subsequently add all interesting files from scratch.</p></div>
1170 <div class="literalblock">
1171 <div class="content">
1172 <pre><tt> 'deleteall' LF</tt></pre>
1173 </div></div>
1174 <div class="paragraph"><p>This command is extremely useful if the frontend does not know
1175 (or does not care to know) what files are currently on the branch,
1176 and therefore cannot generate the proper <tt>filedelete</tt> commands to
1177 update the content.</p></div>
1178 <div class="paragraph"><p>Issuing a <tt>filedeleteall</tt> followed by the needed <tt>filemodify</tt>
1179 commands to set the correct content will produce the same results
1180 as sending only the needed <tt>filemodify</tt> and <tt>filedelete</tt> commands.
1181 The <tt>filedeleteall</tt> approach may however require fast-import to use slightly
1182 more memory per active branch (less than 1 MiB for even most large
1183 projects); so frontends that can easily obtain only the affected
1184 paths for a commit are encouraged to do so.</p></div>
1185 <h4 id="_tt_notemodify_tt"><tt>notemodify</tt></h4>
1186 <div class="paragraph"><p>Included in a <tt>commit</tt> command to add a new note (annotating a given
1187 commit) or change the content of an existing note. This command has
1188 two different means of specifying the content of the note.</p></div>
1189 <div class="dlist"><dl>
1190 <dt class="hdlist1">
1191 External data format
1192 </dt>
1193 <dd>
1195 The data content for the note was already supplied by a prior
1196 <tt>blob</tt> command. The frontend just needs to connect it to the
1197 commit that is to be annotated.
1198 </p>
1199 <div class="literalblock">
1200 <div class="content">
1201 <pre><tt> 'N' SP &lt;dataref&gt; SP &lt;committish&gt; LF</tt></pre>
1202 </div></div>
1203 <div class="paragraph"><p>Here <tt>&lt;dataref&gt;</tt> can be either a mark reference (<tt>:&lt;idnum&gt;</tt>)
1204 set by a prior <tt>blob</tt> command, or a full 40-byte SHA-1 of an
1205 existing Git blob object.</p></div>
1206 </dd>
1207 <dt class="hdlist1">
1208 Inline data format
1209 </dt>
1210 <dd>
1212 The data content for the note has not been supplied yet.
1213 The frontend wants to supply it as part of this modify
1214 command.
1215 </p>
1216 <div class="literalblock">
1217 <div class="content">
1218 <pre><tt> 'N' SP 'inline' SP &lt;committish&gt; LF
1219 data</tt></pre>
1220 </div></div>
1221 <div class="paragraph"><p>See below for a detailed description of the <tt>data</tt> command.</p></div>
1222 </dd>
1223 </dl></div>
1224 <div class="paragraph"><p>In both formats <tt>&lt;committish&gt;</tt> is any of the commit specification
1225 expressions also accepted by <tt>from</tt> (see above).</p></div>
1226 <h3 id="_tt_mark_tt"><tt>mark</tt></h3><div style="clear:left"></div>
1227 <div class="paragraph"><p>Arranges for fast-import to save a reference to the current object, allowing
1228 the frontend to recall this object at a future point in time, without
1229 knowing its SHA-1. Here the current object is the object creation
1230 command the <tt>mark</tt> command appears within. This can be <tt>commit</tt>,
1231 <tt>tag</tt>, and <tt>blob</tt>, but <tt>commit</tt> is the most common usage.</p></div>
1232 <div class="literalblock">
1233 <div class="content">
1234 <pre><tt> 'mark' SP ':' &lt;idnum&gt; LF</tt></pre>
1235 </div></div>
1236 <div class="paragraph"><p>where <tt>&lt;idnum&gt;</tt> is the number assigned by the frontend to this mark.
1237 The value of <tt>&lt;idnum&gt;</tt> is expressed as an ASCII decimal integer.
1238 The value 0 is reserved and cannot be used as
1239 a mark. Only values greater than or equal to 1 may be used as marks.</p></div>
1240 <div class="paragraph"><p>New marks are created automatically. Existing marks can be moved
1241 to another object simply by reusing the same <tt>&lt;idnum&gt;</tt> in another
1242 <tt>mark</tt> command.</p></div>
1243 <h3 id="_tt_tag_tt"><tt>tag</tt></h3><div style="clear:left"></div>
1244 <div class="paragraph"><p>Creates an annotated tag referring to a specific commit. To create
1245 lightweight (non-annotated) tags see the <tt>reset</tt> command below.</p></div>
1246 <div class="literalblock">
1247 <div class="content">
1248 <pre><tt> 'tag' SP &lt;name&gt; LF
1249 'from' SP &lt;committish&gt; LF
1250 'tagger' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF
1251 data</tt></pre>
1252 </div></div>
1253 <div class="paragraph"><p>where <tt>&lt;name&gt;</tt> is the name of the tag to create.</p></div>
1254 <div class="paragraph"><p>Tag names are automatically prefixed with <tt>refs/tags/</tt> when stored
1255 in Git, so importing the CVS branch symbol <tt>RELENG-1_0-FINAL</tt> would
1256 use just <tt>RELENG-1_0-FINAL</tt> for <tt>&lt;name&gt;</tt>, and fast-import will write the
1257 corresponding ref as <tt>refs/tags/RELENG-1_0-FINAL</tt>.</p></div>
1258 <div class="paragraph"><p>The value of <tt>&lt;name&gt;</tt> must be a valid refname in Git and therefore
1259 may contain forward slashes. As <tt>LF</tt> is not valid in a Git refname,
1260 no quoting or escaping syntax is supported here.</p></div>
1261 <div class="paragraph"><p>The <tt>from</tt> command is the same as in the <tt>commit</tt> command; see
1262 above for details.</p></div>
1263 <div class="paragraph"><p>The <tt>tagger</tt> command uses the same format as <tt>committer</tt> within
1264 <tt>commit</tt>; again see above for details.</p></div>
1265 <div class="paragraph"><p>The <tt>data</tt> command following <tt>tagger</tt> must supply the annotated tag
1266 message (see below for <tt>data</tt> command syntax). To import an empty
1267 tag message use a 0 length data. Tag messages are free-form and are
1268 not interpreted by Git. Currently they must be encoded in UTF-8,
1269 as fast-import does not permit other encodings to be specified.</p></div>
1270 <div class="paragraph"><p>Signing annotated tags during import from within fast-import is not
1271 supported. Trying to include your own PGP/GPG signature is not
1272 recommended, as the frontend does not (easily) have access to the
1273 complete set of bytes which normally goes into such a signature.
1274 If signing is required, create lightweight tags from within fast-import with
1275 <tt>reset</tt>, then create the annotated versions of those tags offline
1276 with the standard <em>git tag</em> process.</p></div>
1277 <h3 id="_tt_reset_tt"><tt>reset</tt></h3><div style="clear:left"></div>
1278 <div class="paragraph"><p>Creates (or recreates) the named branch, optionally starting from
1279 a specific revision. The reset command allows a frontend to issue
1280 a new <tt>from</tt> command for an existing branch, or to create a new
1281 branch from an existing commit without creating a new commit.</p></div>
1282 <div class="literalblock">
1283 <div class="content">
1284 <pre><tt> 'reset' SP &lt;ref&gt; LF
1285 ('from' SP &lt;committish&gt; LF)?
1286 LF?</tt></pre>
1287 </div></div>
1288 <div class="paragraph"><p>For a detailed description of <tt>&lt;ref&gt;</tt> and <tt>&lt;committish&gt;</tt> see above
1289 under <tt>commit</tt> and <tt>from</tt>.</p></div>
1290 <div class="paragraph"><p>The <tt>LF</tt> after the command is optional (it used to be required).</p></div>
1291 <div class="paragraph"><p>The <tt>reset</tt> command can also be used to create lightweight
1292 (non-annotated) tags. For example:</p></div>
1293 <div class="exampleblock">
1294 <div class="exampleblock-content">
1295 <div class="literalblock">
1296 <div class="content">
1297 <pre><tt>reset refs/tags/938
1298 from :938</tt></pre>
1299 </div></div>
1300 </div></div>
1301 <div class="paragraph"><p>would create the lightweight tag <tt>refs/tags/938</tt> referring to
1302 whatever commit mark <tt>:938</tt> references.</p></div>
1303 <h3 id="_tt_blob_tt"><tt>blob</tt></h3><div style="clear:left"></div>
1304 <div class="paragraph"><p>Requests writing one file revision to the packfile. The revision
1305 is not connected to any commit; this connection must be formed in
1306 a subsequent <tt>commit</tt> command by referencing the blob through an
1307 assigned mark.</p></div>
1308 <div class="literalblock">
1309 <div class="content">
1310 <pre><tt> 'blob' LF
1311 mark?
1312 data</tt></pre>
1313 </div></div>
1314 <div class="paragraph"><p>The mark command is optional here as some frontends have chosen
1315 to generate the Git SHA-1 for the blob on their own, and feed that
1316 directly to <tt>commit</tt>. This is typically more work than it&#8217;s worth
1317 however, as marks are inexpensive to store and easy to use.</p></div>
1318 <h3 id="_tt_data_tt"><tt>data</tt></h3><div style="clear:left"></div>
1319 <div class="paragraph"><p>Supplies raw data (for use as blob/file content, commit messages, or
1320 annotated tag messages) to fast-import. Data can be supplied using an exact
1321 byte count or delimited with a terminating line. Real frontends
1322 intended for production-quality conversions should always use the
1323 exact byte count format, as it is more robust and performs better.
1324 The delimited format is intended primarily for testing fast-import.</p></div>
1325 <div class="paragraph"><p>Comment lines appearing within the <tt>&lt;raw&gt;</tt> part of <tt>data</tt> commands
1326 are always taken to be part of the body of the data and are therefore
1327 never ignored by fast-import. This makes it safe to import any
1328 file/message content whose lines might start with <tt>#</tt>.</p></div>
1329 <div class="dlist"><dl>
1330 <dt class="hdlist1">
1331 Exact byte count format
1332 </dt>
1333 <dd>
1335 The frontend must specify the number of bytes of data.
1336 </p>
1337 <div class="literalblock">
1338 <div class="content">
1339 <pre><tt> 'data' SP &lt;count&gt; LF
1340 &lt;raw&gt; LF?</tt></pre>
1341 </div></div>
1342 <div class="paragraph"><p>where <tt>&lt;count&gt;</tt> is the exact number of bytes appearing within
1343 <tt>&lt;raw&gt;</tt>. The value of <tt>&lt;count&gt;</tt> is expressed as an ASCII decimal
1344 integer. The <tt>LF</tt> on either side of <tt>&lt;raw&gt;</tt> is not
1345 included in <tt>&lt;count&gt;</tt> and will not be included in the imported data.</p></div>
1346 <div class="paragraph"><p>The <tt>LF</tt> after <tt>&lt;raw&gt;</tt> is optional (it used to be required) but
1347 recommended. Always including it makes debugging a fast-import
1348 stream easier as the next command always starts in column 0
1349 of the next line, even if <tt>&lt;raw&gt;</tt> did not end with an <tt>LF</tt>.</p></div>
1350 </dd>
1351 <dt class="hdlist1">
1352 Delimited format
1353 </dt>
1354 <dd>
1356 A delimiter string is used to mark the end of the data.
1357 fast-import will compute the length by searching for the delimiter.
1358 This format is primarily useful for testing and is not
1359 recommended for real data.
1360 </p>
1361 <div class="literalblock">
1362 <div class="content">
1363 <pre><tt> 'data' SP '&lt;&lt;' &lt;delim&gt; LF
1364 &lt;raw&gt; LF
1365 &lt;delim&gt; LF
1366 LF?</tt></pre>
1367 </div></div>
1368 <div class="paragraph"><p>where <tt>&lt;delim&gt;</tt> is the chosen delimiter string. The string <tt>&lt;delim&gt;</tt>
1369 must not appear on a line by itself within <tt>&lt;raw&gt;</tt>, as otherwise
1370 fast-import will think the data ends earlier than it really does. The <tt>LF</tt>
1371 immediately trailing <tt>&lt;raw&gt;</tt> is part of <tt>&lt;raw&gt;</tt>. This is one of
1372 the limitations of the delimited format, it is impossible to supply
1373 a data chunk which does not have an LF as its last byte.</p></div>
1374 <div class="paragraph"><p>The <tt>LF</tt> after <tt>&lt;delim&gt; LF</tt> is optional (it used to be required).</p></div>
1375 </dd>
1376 </dl></div>
1377 <h3 id="_tt_checkpoint_tt"><tt>checkpoint</tt></h3><div style="clear:left"></div>
1378 <div class="paragraph"><p>Forces fast-import to close the current packfile, start a new one, and to
1379 save out all current branch refs, tags and marks.</p></div>
1380 <div class="literalblock">
1381 <div class="content">
1382 <pre><tt> 'checkpoint' LF
1383 LF?</tt></pre>
1384 </div></div>
1385 <div class="paragraph"><p>Note that fast-import automatically switches packfiles when the current
1386 packfile reaches --max-pack-size, or 4 GiB, whichever limit is
1387 smaller. During an automatic packfile switch fast-import does not update
1388 the branch refs, tags or marks.</p></div>
1389 <div class="paragraph"><p>As a <tt>checkpoint</tt> can require a significant amount of CPU time and
1390 disk IO (to compute the overall pack SHA-1 checksum, generate the
1391 corresponding index file, and update the refs) it can easily take
1392 several minutes for a single <tt>checkpoint</tt> command to complete.</p></div>
1393 <div class="paragraph"><p>Frontends may choose to issue checkpoints during extremely large
1394 and long running imports, or when they need to allow another Git
1395 process access to a branch. However given that a 30 GiB Subversion
1396 repository can be loaded into Git through fast-import in about 3 hours,
1397 explicit checkpointing may not be necessary.</p></div>
1398 <div class="paragraph"><p>The <tt>LF</tt> after the command is optional (it used to be required).</p></div>
1399 <h3 id="_tt_progress_tt"><tt>progress</tt></h3><div style="clear:left"></div>
1400 <div class="paragraph"><p>Causes fast-import to print the entire <tt>progress</tt> line unmodified to
1401 its standard output channel (file descriptor 1) when the command is
1402 processed from the input stream. The command otherwise has no impact
1403 on the current import, or on any of fast-import&#8217;s internal state.</p></div>
1404 <div class="literalblock">
1405 <div class="content">
1406 <pre><tt> 'progress' SP &lt;any&gt; LF
1407 LF?</tt></pre>
1408 </div></div>
1409 <div class="paragraph"><p>The <tt>&lt;any&gt;</tt> part of the command may contain any sequence of bytes
1410 that does not contain <tt>LF</tt>. The <tt>LF</tt> after the command is optional.
1411 Callers may wish to process the output through a tool such as sed to
1412 remove the leading part of the line, for example:</p></div>
1413 <div class="exampleblock">
1414 <div class="exampleblock-content">
1415 <div class="literalblock">
1416 <div class="content">
1417 <pre><tt>frontend | git fast-import | sed 's/^progress //'</tt></pre>
1418 </div></div>
1419 </div></div>
1420 <div class="paragraph"><p>Placing a <tt>progress</tt> command immediately after a <tt>checkpoint</tt> will
1421 inform the reader when the <tt>checkpoint</tt> has been completed and it
1422 can safely access the refs that fast-import updated.</p></div>
1423 <h3 id="_tt_cat_blob_tt"><tt>cat-blob</tt></h3><div style="clear:left"></div>
1424 <div class="paragraph"><p>Causes fast-import to print a blob to a file descriptor previously
1425 arranged with the <tt>--cat-blob-fd</tt> argument. The command otherwise
1426 has no impact on the current import; its main purpose is to
1427 retrieve blobs that may be in fast-import&#8217;s memory but not
1428 accessible from the target repository.</p></div>
1429 <div class="literalblock">
1430 <div class="content">
1431 <pre><tt> 'cat-blob' SP &lt;dataref&gt; LF</tt></pre>
1432 </div></div>
1433 <div class="paragraph"><p>The <tt>&lt;dataref&gt;</tt> can be either a mark reference (<tt>:&lt;idnum&gt;</tt>)
1434 set previously or a full 40-byte SHA-1 of a Git blob, preexisting or
1435 ready to be written.</p></div>
1436 <div class="paragraph"><p>Output uses the same format as <tt>git cat-file --batch</tt>:</p></div>
1437 <div class="exampleblock">
1438 <div class="exampleblock-content">
1439 <div class="literalblock">
1440 <div class="content">
1441 <pre><tt>&lt;sha1&gt; SP 'blob' SP &lt;size&gt; LF
1442 &lt;contents&gt; LF</tt></pre>
1443 </div></div>
1444 </div></div>
1445 <div class="paragraph"><p>This command can be used anywhere in the stream that comments are
1446 accepted. In particular, the <tt>cat-blob</tt> command can be used in the
1447 middle of a commit but not in the middle of a <tt>data</tt> command.</p></div>
1448 <h3 id="_tt_ls_tt"><tt>ls</tt></h3><div style="clear:left"></div>
1449 <div class="paragraph"><p>Prints information about the object at a path to a file descriptor
1450 previously arranged with the <tt>--cat-blob-fd</tt> argument. This allows
1451 printing a blob from the active commit (with <tt>cat-blob</tt>) or copying a
1452 blob or tree from a previous commit for use in the current one (with
1453 <tt>filemodify</tt>).</p></div>
1454 <div class="paragraph"><p>The <tt>ls</tt> command can be used anywhere in the stream that comments are
1455 accepted, including the middle of a commit.</p></div>
1456 <div class="dlist"><dl>
1457 <dt class="hdlist1">
1458 Reading from the active commit
1459 </dt>
1460 <dd>
1462 This form can only be used in the middle of a <tt>commit</tt>.
1463 The path names a directory entry within fast-import&#8217;s
1464 active commit. The path must be quoted in this case.
1465 </p>
1466 <div class="literalblock">
1467 <div class="content">
1468 <pre><tt> 'ls' SP &lt;path&gt; LF</tt></pre>
1469 </div></div>
1470 </dd>
1471 <dt class="hdlist1">
1472 Reading from a named tree
1473 </dt>
1474 <dd>
1476 The <tt>&lt;dataref&gt;</tt> can be a mark reference (<tt>:&lt;idnum&gt;</tt>) or the
1477 full 40-byte SHA-1 of a Git tag, commit, or tree object,
1478 preexisting or waiting to be written.
1479 The path is relative to the top level of the tree
1480 named by <tt>&lt;dataref&gt;</tt>.
1481 </p>
1482 <div class="literalblock">
1483 <div class="content">
1484 <pre><tt> 'ls' SP &lt;dataref&gt; SP &lt;path&gt; LF</tt></pre>
1485 </div></div>
1486 </dd>
1487 </dl></div>
1488 <div class="paragraph"><p>See <tt>filemodify</tt> above for a detailed description of <tt>&lt;path&gt;</tt>.</p></div>
1489 <div class="paragraph"><p>Output uses the same format as <tt>git ls-tree &lt;tree&gt; &#45;&#45; &lt;path&gt;</tt>:</p></div>
1490 <div class="exampleblock">
1491 <div class="exampleblock-content">
1492 <div class="literalblock">
1493 <div class="content">
1494 <pre><tt>&lt;mode&gt; SP ('blob' | 'tree' | 'commit') SP &lt;dataref&gt; HT &lt;path&gt; LF</tt></pre>
1495 </div></div>
1496 </div></div>
1497 <div class="paragraph"><p>The &lt;dataref&gt; represents the blob, tree, or commit object at &lt;path&gt;
1498 and can be used in later <em>cat-blob</em>, <em>filemodify</em>, or <em>ls</em> commands.</p></div>
1499 <div class="paragraph"><p>If there is no file or subtree at that path, <em>git fast-import</em> will
1500 instead report</p></div>
1501 <div class="exampleblock">
1502 <div class="exampleblock-content">
1503 <div class="literalblock">
1504 <div class="content">
1505 <pre><tt>missing SP &lt;path&gt; LF</tt></pre>
1506 </div></div>
1507 </div></div>
1508 <h3 id="_tt_feature_tt"><tt>feature</tt></h3><div style="clear:left"></div>
1509 <div class="paragraph"><p>Require that fast-import supports the specified feature, or abort if
1510 it does not.</p></div>
1511 <div class="literalblock">
1512 <div class="content">
1513 <pre><tt> 'feature' SP &lt;feature&gt; ('=' &lt;argument&gt;)? LF</tt></pre>
1514 </div></div>
1515 <div class="paragraph"><p>The &lt;feature&gt; part of the command may be any one of the following:</p></div>
1516 <div class="dlist"><dl>
1517 <dt class="hdlist1">
1518 date-format
1519 </dt>
1520 <dt class="hdlist1">
1521 export-marks
1522 </dt>
1523 <dt class="hdlist1">
1524 relative-marks
1525 </dt>
1526 <dt class="hdlist1">
1527 no-relative-marks
1528 </dt>
1529 <dt class="hdlist1">
1530 force
1531 </dt>
1532 <dd>
1534 Act as though the corresponding command-line option with
1535 a leading <em>--</em> was passed on the command line
1536 (see OPTIONS, above).
1537 </p>
1538 </dd>
1539 <dt class="hdlist1">
1540 import-marks
1541 </dt>
1542 <dd>
1544 Like --import-marks except in two respects: first, only one
1545 "feature import-marks" command is allowed per stream;
1546 second, an --import-marks= command-line option overrides
1547 any "feature import-marks" command in the stream.
1548 </p>
1549 </dd>
1550 <dt class="hdlist1">
1551 cat-blob
1552 </dt>
1553 <dt class="hdlist1">
1555 </dt>
1556 <dd>
1558 Require that the backend support the <em>cat-blob</em> or <em>ls</em> command.
1559 Versions of fast-import not supporting the specified command
1560 will exit with a message indicating so.
1561 This lets the import error out early with a clear message,
1562 rather than wasting time on the early part of an import
1563 before the unsupported command is detected.
1564 </p>
1565 </dd>
1566 <dt class="hdlist1">
1567 notes
1568 </dt>
1569 <dd>
1571 Require that the backend support the <em>notemodify</em> (N)
1572 subcommand to the <em>commit</em> command.
1573 Versions of fast-import not supporting notes will exit
1574 with a message indicating so.
1575 </p>
1576 </dd>
1577 </dl></div>
1578 <h3 id="_tt_option_tt"><tt>option</tt></h3><div style="clear:left"></div>
1579 <div class="paragraph"><p>Processes the specified option so that git fast-import behaves in a
1580 way that suits the frontend&#8217;s needs.
1581 Note that options specified by the frontend are overridden by any
1582 options the user may specify to git fast-import itself.</p></div>
1583 <div class="literalblock">
1584 <div class="content">
1585 <pre><tt> 'option' SP &lt;option&gt; LF</tt></pre>
1586 </div></div>
1587 <div class="paragraph"><p>The <tt>&lt;option&gt;</tt> part of the command may contain any of the options
1588 listed in the OPTIONS section that do not change import semantics,
1589 without the leading <em>--</em> and is treated in the same way.</p></div>
1590 <div class="paragraph"><p>Option commands must be the first commands on the input (not counting
1591 feature commands), to give an option command after any non-option
1592 command is an error.</p></div>
1593 <div class="paragraph"><p>The following commandline options change import semantics and may therefore
1594 not be passed as option:</p></div>
1595 <div class="ulist"><ul>
1596 <li>
1598 date-format
1599 </p>
1600 </li>
1601 <li>
1603 import-marks
1604 </p>
1605 </li>
1606 <li>
1608 export-marks
1609 </p>
1610 </li>
1611 <li>
1613 cat-blob-fd
1614 </p>
1615 </li>
1616 <li>
1618 force
1619 </p>
1620 </li>
1621 </ul></div>
1622 </div>
1623 <h2 id="_crash_reports">Crash Reports</h2>
1624 <div class="sectionbody">
1625 <div class="paragraph"><p>If fast-import is supplied invalid input it will terminate with a
1626 non-zero exit status and create a crash report in the top level of
1627 the Git repository it was importing into. Crash reports contain
1628 a snapshot of the internal fast-import state as well as the most
1629 recent commands that lead up to the crash.</p></div>
1630 <div class="paragraph"><p>All recent commands (including stream comments, file changes and
1631 progress commands) are shown in the command history within the crash
1632 report, but raw file data and commit messages are excluded from the
1633 crash report. This exclusion saves space within the report file
1634 and reduces the amount of buffering that fast-import must perform
1635 during execution.</p></div>
1636 <div class="paragraph"><p>After writing a crash report fast-import will close the current
1637 packfile and export the marks table. This allows the frontend
1638 developer to inspect the repository state and resume the import from
1639 the point where it crashed. The modified branches and tags are not
1640 updated during a crash, as the import did not complete successfully.
1641 Branch and tag information can be found in the crash report and
1642 must be applied manually if the update is needed.</p></div>
1643 <div class="paragraph"><p>An example crash:</p></div>
1644 <div class="exampleblock">
1645 <div class="exampleblock-content">
1646 <div class="literalblock">
1647 <div class="content">
1648 <pre><tt>$ cat &gt;in &lt;&lt;END_OF_INPUT
1649 # my very first test commit
1650 commit refs/heads/master
1651 committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400
1652 # who is that guy anyway?
1653 data &lt;&lt;EOF
1654 this is my commit
1656 M 644 inline .gitignore
1657 data &lt;&lt;EOF
1658 .gitignore
1660 M 777 inline bob
1661 END_OF_INPUT</tt></pre>
1662 </div></div>
1663 <div class="literalblock">
1664 <div class="content">
1665 <pre><tt>$ git fast-import &lt;in
1666 fatal: Corrupt mode: M 777 inline bob
1667 fast-import: dumping crash report to .git/fast_import_crash_8434</tt></pre>
1668 </div></div>
1669 <div class="literalblock">
1670 <div class="content">
1671 <pre><tt>$ cat .git/fast_import_crash_8434
1672 fast-import crash report:
1673 fast-import process: 8434
1674 parent process : 1391
1675 at Sat Sep 1 00:58:12 2007</tt></pre>
1676 </div></div>
1677 <div class="literalblock">
1678 <div class="content">
1679 <pre><tt>fatal: Corrupt mode: M 777 inline bob</tt></pre>
1680 </div></div>
1681 <div class="literalblock">
1682 <div class="content">
1683 <pre><tt>Most Recent Commands Before Crash
1684 ---------------------------------
1685 # my very first test commit
1686 commit refs/heads/master
1687 committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400
1688 # who is that guy anyway?
1689 data &lt;&lt;EOF
1690 M 644 inline .gitignore
1691 data &lt;&lt;EOF
1692 * M 777 inline bob</tt></pre>
1693 </div></div>
1694 <div class="literalblock">
1695 <div class="content">
1696 <pre><tt>Active Branch LRU
1697 -----------------
1698 active_branches = 1 cur, 5 max</tt></pre>
1699 </div></div>
1700 <div class="literalblock">
1701 <div class="content">
1702 <pre><tt>pos clock name
1703 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1704 1) 0 refs/heads/master</tt></pre>
1705 </div></div>
1706 <div class="literalblock">
1707 <div class="content">
1708 <pre><tt>Inactive Branches
1709 -----------------
1710 refs/heads/master:
1711 status : active loaded dirty
1712 tip commit : 0000000000000000000000000000000000000000
1713 old tree : 0000000000000000000000000000000000000000
1714 cur tree : 0000000000000000000000000000000000000000
1715 commit clock: 0
1716 last pack :</tt></pre>
1717 </div></div>
1718 <div class="literalblock">
1719 <div class="content">
1720 <pre><tt>-------------------
1721 END OF CRASH REPORT</tt></pre>
1722 </div></div>
1723 </div></div>
1724 </div>
1725 <h2 id="_tips_and_tricks">Tips and Tricks</h2>
1726 <div class="sectionbody">
1727 <div class="paragraph"><p>The following tips and tricks have been collected from various
1728 users of fast-import, and are offered here as suggestions.</p></div>
1729 <h3 id="_use_one_mark_per_commit">Use One Mark Per Commit</h3><div style="clear:left"></div>
1730 <div class="paragraph"><p>When doing a repository conversion, use a unique mark per commit
1731 (<tt>mark :&lt;n&gt;</tt>) and supply the --export-marks option on the command
1732 line. fast-import will dump a file which lists every mark and the Git
1733 object SHA-1 that corresponds to it. If the frontend can tie
1734 the marks back to the source repository, it is easy to verify the
1735 accuracy and completeness of the import by comparing each Git
1736 commit to the corresponding source revision.</p></div>
1737 <div class="paragraph"><p>Coming from a system such as Perforce or Subversion this should be
1738 quite simple, as the fast-import mark can also be the Perforce changeset
1739 number or the Subversion revision number.</p></div>
1740 <h3 id="_freely_skip_around_branches">Freely Skip Around Branches</h3><div style="clear:left"></div>
1741 <div class="paragraph"><p>Don&#8217;t bother trying to optimize the frontend to stick to one branch
1742 at a time during an import. Although doing so might be slightly
1743 faster for fast-import, it tends to increase the complexity of the frontend
1744 code considerably.</p></div>
1745 <div class="paragraph"><p>The branch LRU builtin to fast-import tends to behave very well, and the
1746 cost of activating an inactive branch is so low that bouncing around
1747 between branches has virtually no impact on import performance.</p></div>
1748 <h3 id="_handling_renames">Handling Renames</h3><div style="clear:left"></div>
1749 <div class="paragraph"><p>When importing a renamed file or directory, simply delete the old
1750 name(s) and modify the new name(s) during the corresponding commit.
1751 Git performs rename detection after-the-fact, rather than explicitly
1752 during a commit.</p></div>
1753 <h3 id="_use_tag_fixup_branches">Use Tag Fixup Branches</h3><div style="clear:left"></div>
1754 <div class="paragraph"><p>Some other SCM systems let the user create a tag from multiple
1755 files which are not from the same commit/changeset. Or to create
1756 tags which are a subset of the files available in the repository.</p></div>
1757 <div class="paragraph"><p>Importing these tags as-is in Git is impossible without making at
1758 least one commit which &#8220;fixes up&#8221; the files to match the content
1759 of the tag. Use fast-import&#8217;s <tt>reset</tt> command to reset a dummy branch
1760 outside of your normal branch space to the base commit for the tag,
1761 then commit one or more file fixup commits, and finally tag the
1762 dummy branch.</p></div>
1763 <div class="paragraph"><p>For example since all normal branches are stored under <tt>refs/heads/</tt>
1764 name the tag fixup branch <tt>TAG_FIXUP</tt>. This way it is impossible for
1765 the fixup branch used by the importer to have namespace conflicts
1766 with real branches imported from the source (the name <tt>TAG_FIXUP</tt>
1767 is not <tt>refs/heads/TAG_FIXUP</tt>).</p></div>
1768 <div class="paragraph"><p>When committing fixups, consider using <tt>merge</tt> to connect the
1769 commit(s) which are supplying file revisions to the fixup branch.
1770 Doing so will allow tools such as <em>git blame</em> to track
1771 through the real commit history and properly annotate the source
1772 files.</p></div>
1773 <div class="paragraph"><p>After fast-import terminates the frontend will need to do <tt>rm .git/TAG_FIXUP</tt>
1774 to remove the dummy branch.</p></div>
1775 <h3 id="_import_now_repack_later">Import Now, Repack Later</h3><div style="clear:left"></div>
1776 <div class="paragraph"><p>As soon as fast-import completes the Git repository is completely valid
1777 and ready for use. Typically this takes only a very short time,
1778 even for considerably large projects (100,000+ commits).</p></div>
1779 <div class="paragraph"><p>However repacking the repository is necessary to improve data
1780 locality and access performance. It can also take hours on extremely
1781 large projects (especially if -f and a large --window parameter is
1782 used). Since repacking is safe to run alongside readers and writers,
1783 run the repack in the background and let it finish when it finishes.
1784 There is no reason to wait to explore your new Git project!</p></div>
1785 <div class="paragraph"><p>If you choose to wait for the repack, don&#8217;t try to run benchmarks
1786 or performance tests until repacking is completed. fast-import outputs
1787 suboptimal packfiles that are simply never seen in real use
1788 situations.</p></div>
1789 <h3 id="_repacking_historical_data">Repacking Historical Data</h3><div style="clear:left"></div>
1790 <div class="paragraph"><p>If you are repacking very old imported data (e.g. older than the
1791 last year), consider expending some extra CPU time and supplying
1792 --window=50 (or higher) when you run <em>git repack</em>.
1793 This will take longer, but will also produce a smaller packfile.
1794 You only need to expend the effort once, and everyone using your
1795 project will benefit from the smaller repository.</p></div>
1796 <h3 id="_include_some_progress_messages">Include Some Progress Messages</h3><div style="clear:left"></div>
1797 <div class="paragraph"><p>Every once in a while have your frontend emit a <tt>progress</tt> message
1798 to fast-import. The contents of the messages are entirely free-form,
1799 so one suggestion would be to output the current month and year
1800 each time the current commit date moves into the next month.
1801 Your users will feel better knowing how much of the data stream
1802 has been processed.</p></div>
1803 </div>
1804 <h2 id="_packfile_optimization">Packfile Optimization</h2>
1805 <div class="sectionbody">
1806 <div class="paragraph"><p>When packing a blob fast-import always attempts to deltify against the last
1807 blob written. Unless specifically arranged for by the frontend,
1808 this will probably not be a prior version of the same file, so the
1809 generated delta will not be the smallest possible. The resulting
1810 packfile will be compressed, but will not be optimal.</p></div>
1811 <div class="paragraph"><p>Frontends which have efficient access to all revisions of a
1812 single file (for example reading an RCS/CVS ,v file) can choose
1813 to supply all revisions of that file as a sequence of consecutive
1814 <tt>blob</tt> commands. This allows fast-import to deltify the different file
1815 revisions against each other, saving space in the final packfile.
1816 Marks can be used to later identify individual file revisions during
1817 a sequence of <tt>commit</tt> commands.</p></div>
1818 <div class="paragraph"><p>The packfile(s) created by fast-import do not encourage good disk access
1819 patterns. This is caused by fast-import writing the data in the order
1820 it is received on standard input, while Git typically organizes
1821 data within packfiles to make the most recent (current tip) data
1822 appear before historical data. Git also clusters commits together,
1823 speeding up revision traversal through better cache locality.</p></div>
1824 <div class="paragraph"><p>For this reason it is strongly recommended that users repack the
1825 repository with <tt>git repack -a -d</tt> after fast-import completes, allowing
1826 Git to reorganize the packfiles for faster data access. If blob
1827 deltas are suboptimal (see above) then also adding the <tt>-f</tt> option
1828 to force recomputation of all deltas can significantly reduce the
1829 final packfile size (30-50% smaller can be quite typical).</p></div>
1830 </div>
1831 <h2 id="_memory_utilization">Memory Utilization</h2>
1832 <div class="sectionbody">
1833 <div class="paragraph"><p>There are a number of factors which affect how much memory fast-import
1834 requires to perform an import. Like critical sections of core
1835 Git, fast-import uses its own memory allocators to amortize any overheads
1836 associated with malloc. In practice fast-import tends to amortize any
1837 malloc overheads to 0, due to its use of large block allocations.</p></div>
1838 <h3 id="_per_object">per object</h3><div style="clear:left"></div>
1839 <div class="paragraph"><p>fast-import maintains an in-memory structure for every object written in
1840 this execution. On a 32 bit system the structure is 32 bytes,
1841 on a 64 bit system the structure is 40 bytes (due to the larger
1842 pointer sizes). Objects in the table are not deallocated until
1843 fast-import terminates. Importing 2 million objects on a 32 bit system
1844 will require approximately 64 MiB of memory.</p></div>
1845 <div class="paragraph"><p>The object table is actually a hashtable keyed on the object name
1846 (the unique SHA-1). This storage configuration allows fast-import to reuse
1847 an existing or already written object and avoid writing duplicates
1848 to the output packfile. Duplicate blobs are surprisingly common
1849 in an import, typically due to branch merges in the source.</p></div>
1850 <h3 id="_per_mark">per mark</h3><div style="clear:left"></div>
1851 <div class="paragraph"><p>Marks are stored in a sparse array, using 1 pointer (4 bytes or 8
1852 bytes, depending on pointer size) per mark. Although the array
1853 is sparse, frontends are still strongly encouraged to use marks
1854 between 1 and n, where n is the total number of marks required for
1855 this import.</p></div>
1856 <h3 id="_per_branch">per branch</h3><div style="clear:left"></div>
1857 <div class="paragraph"><p>Branches are classified as active and inactive. The memory usage
1858 of the two classes is significantly different.</p></div>
1859 <div class="paragraph"><p>Inactive branches are stored in a structure which uses 96 or 120
1860 bytes (32 bit or 64 bit systems, respectively), plus the length of
1861 the branch name (typically under 200 bytes), per branch. fast-import will
1862 easily handle as many as 10,000 inactive branches in under 2 MiB
1863 of memory.</p></div>
1864 <div class="paragraph"><p>Active branches have the same overhead as inactive branches, but
1865 also contain copies of every tree that has been recently modified on
1866 that branch. If subtree <tt>include</tt> has not been modified since the
1867 branch became active, its contents will not be loaded into memory,
1868 but if subtree <tt>src</tt> has been modified by a commit since the branch
1869 became active, then its contents will be loaded in memory.</p></div>
1870 <div class="paragraph"><p>As active branches store metadata about the files contained on that
1871 branch, their in-memory storage size can grow to a considerable size
1872 (see below).</p></div>
1873 <div class="paragraph"><p>fast-import automatically moves active branches to inactive status based on
1874 a simple least-recently-used algorithm. The LRU chain is updated on
1875 each <tt>commit</tt> command. The maximum number of active branches can be
1876 increased or decreased on the command line with --active-branches=.</p></div>
1877 <h3 id="_per_active_tree">per active tree</h3><div style="clear:left"></div>
1878 <div class="paragraph"><p>Trees (aka directories) use just 12 bytes of memory on top of the
1879 memory required for their entries (see &#8220;per active file&#8221; below).
1880 The cost of a tree is virtually 0, as its overhead amortizes out
1881 over the individual file entries.</p></div>
1882 <h3 id="_per_active_file_entry">per active file entry</h3><div style="clear:left"></div>
1883 <div class="paragraph"><p>Files (and pointers to subtrees) within active trees require 52 or 64
1884 bytes (32/64 bit platforms) per entry. To conserve space, file and
1885 tree names are pooled in a common string table, allowing the filename
1886 &#8220;Makefile&#8221; to use just 16 bytes (after including the string header
1887 overhead) no matter how many times it occurs within the project.</p></div>
1888 <div class="paragraph"><p>The active branch LRU, when coupled with the filename string pool
1889 and lazy loading of subtrees, allows fast-import to efficiently import
1890 projects with 2,000+ branches and 45,114+ files in a very limited
1891 memory footprint (less than 2.7 MiB per active branch).</p></div>
1892 </div>
1893 <h2 id="_signals">Signals</h2>
1894 <div class="sectionbody">
1895 <div class="paragraph"><p>Sending <strong>SIGUSR1</strong> to the <em>git fast-import</em> process ends the current
1896 packfile early, simulating a <tt>checkpoint</tt> command. The impatient
1897 operator can use this facility to peek at the objects and refs from an
1898 import in progress, at the cost of some added running time and worse
1899 compression.</p></div>
1900 </div>
1901 <h2 id="_git">GIT</h2>
1902 <div class="sectionbody">
1903 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1904 </div>
1905 <div id="footer">
1906 <div id="footer-text">
1907 Last updated 2011-03-15 23:30:13 UTC
1908 </div>
1909 </div>
1910 </body>
1911 </html>