Autogenerated HTML docs for v2.45.1-204-gd8ab1
[git-htmldocs.git] / git-fast-import.html
blob92cf5392a1cf9cd4e46a7fa271d6a12652e28bb4
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
7 <meta name="generator" content="AsciiDoc 10.2.0" />
8 <title>git-fast-import(1)</title>
9 <style type="text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
12 /* Default font. */
13 body {
14 font-family: Georgia,serif;
17 /* Title font. */
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
21 #toctitle,
22 #author, #revnumber, #revdate, #revremark,
23 #footer {
24 font-family: Arial,Helvetica,sans-serif;
27 body {
28 margin: 1em 5% 1em 5%;
31 a {
32 color: blue;
33 text-decoration: underline;
35 a:visited {
36 color: fuchsia;
39 em {
40 font-style: italic;
41 color: navy;
44 strong {
45 font-weight: bold;
46 color: #083194;
49 h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
51 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
56 h1, h2, h3 {
57 border-bottom: 2px solid silver;
59 h2 {
60 padding-top: 0.5em;
62 h3 {
63 float: left;
65 h3 + * {
66 clear: left;
68 h5 {
69 font-size: 1.0em;
72 div.sectionbody {
73 margin-left: 0;
76 hr {
77 border: 1px solid silver;
80 p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
85 ul, ol, li > p {
86 margin-top: 0;
88 ul > li { color: #aaa; }
89 ul > li > * { color: black; }
91 .monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
98 pre {
99 white-space: pre-wrap;
102 #author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
107 #email {
109 #revnumber, #revdate, #revremark {
112 #footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
118 #footer-text {
119 float: left;
120 padding-bottom: 0.5em;
122 #footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
127 #preamble {
128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
134 margin-top: 1.0em;
135 margin-bottom: 1.5em;
137 div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
144 div.content { /* Block element content. */
145 padding: 0;
148 /* Block element titles. */
149 div.title, caption.title {
150 color: #527bbd;
151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
156 div.title + * {
157 margin-top: 0;
160 td div.title:first-child {
161 margin-top: 0.0em;
163 div.content div.title:first-child {
164 margin-top: 0.0em;
166 div.content + div.title {
167 margin-top: 0.0em;
170 div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
177 div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
184 div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
187 margin-right: 10%;
188 border-left: 5px solid #f0f0f0;
189 color: #888;
192 div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
197 div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
201 div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
207 text-align: left;
210 div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
218 div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
223 div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
228 div.imageblock div.content { padding-left: 0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
232 dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
236 dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
242 dd > *:first-child {
243 margin-top: 0.1em;
246 ul, ol {
247 list-style-position: outside;
249 ol.arabic {
250 list-style-type: decimal;
252 ol.loweralpha {
253 list-style-type: lower-alpha;
255 ol.upperalpha {
256 list-style-type: upper-alpha;
258 ol.lowerroman {
259 list-style-type: lower-roman;
261 ol.upperroman {
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
272 tfoot {
273 font-weight: bold;
275 td > div.verse {
276 white-space: pre;
279 div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
283 div.hdlist tr {
284 padding-bottom: 15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
289 td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
295 td.hdlist2 {
296 vertical-align: top;
298 div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
303 .comment {
304 background: yellow;
307 .footnote, .footnoteref {
308 font-size: 0.8em;
311 span.footnote, span.footnoteref {
312 vertical-align: super;
315 #footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
320 #footnotes div.footnote {
321 margin: 0 0 5px 0;
324 #footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
334 div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
339 div.colist td img {
340 margin-top: 0.3em;
343 @media print {
344 #footer-badges { display: none; }
347 #toc {
348 margin-bottom: 2.5em;
351 #toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
363 div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
367 div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
371 div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size: 2em; }
411 span.small { font-size: 0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
421 * xhtml11 specific
423 * */
425 div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
429 div.tableblock > table {
430 border: 3px solid #527bbd;
432 thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
436 p.table {
437 margin-top: 0;
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock > table[frame="void"] {
441 border-style: none;
443 div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
454 * html5 specific
456 * */
458 table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
462 thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
466 p.tableblock {
467 margin-top: 0;
469 table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
498 th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
501 th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
505 th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
517 * manpage specific
519 * */
521 body.manpage h1 {
522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
527 body.manpage h2 {
528 border-style: none;
530 body.manpage div.sectionbody {
531 margin-left: 3em;
534 @media print {
535 body.manpage div#toc { display: none; }
539 </style>
540 <script type="text/javascript">
541 /*<![CDATA[*/
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
552 * Version: 0.4
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
561 // toclevels = 1..4.
562 toc: function (toclevels) {
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
572 return text;
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
586 // browsers).
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
594 iterate(i);
598 iterate(el);
599 return result;
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
610 for (i = 0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute("class")
614 && entry.getAttribute("class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById("content"), toclevels);
623 for (var i = 0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id == "")
626 entry.element.id = "_toc_" + i;
627 var a = document.createElement("a");
628 a.href = "#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement("div");
631 div.appendChild(a);
632 div.className = "toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
659 entriesToRemove.push(entry);
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById("content");
667 var spans = cont.getElementsByTagName("span");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!note) {
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
678 spans[i].innerHTML =
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
681 spans[i].setAttribute("data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
687 var id =spans[i].getAttribute("id");
688 if (id != null) refs["#"+id] = n;
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
694 // Process footnoterefs.
695 for (i=0; i<spans.length; i++) {
696 if (spans[i].className == "footnoteref") {
697 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
698 href = href.match(/#.*/)[0]; // Because IE return full URL.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
708 install: function(toclevels) {
709 var timerId;
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
731 asciidoc.install();
732 /*]]>*/
733 </script>
734 </head>
735 <body class="manpage">
736 <div id="header">
737 <h1>
738 git-fast-import(1) Manual Page
739 </h1>
740 <h2>NAME</h2>
741 <div class="sectionbody">
742 <p>git-fast-import -
743 Backend for fast Git data importers
744 </p>
745 </div>
746 </div>
747 <div id="content">
748 <div class="sect1">
749 <h2 id="_synopsis">SYNOPSIS</h2>
750 <div class="sectionbody">
751 <div class="verseblock">
752 <pre class="content">frontend | <em>git fast-import</em> [&lt;options&gt;]</pre>
753 <div class="attribution">
754 </div></div>
755 </div>
756 </div>
757 <div class="sect1">
758 <h2 id="_description">DESCRIPTION</h2>
759 <div class="sectionbody">
760 <div class="paragraph"><p>This program is usually not what the end user wants to run directly.
761 Most end users want to use one of the existing frontend programs,
762 which parses a specific type of foreign source and feeds the contents
763 stored there to <em>git fast-import</em>.</p></div>
764 <div class="paragraph"><p>fast-import reads a mixed command/data stream from standard input and
765 writes one or more packfiles directly into the current repository.
766 When EOF is received on standard input, fast import writes out
767 updated branch and tag refs, fully updating the current repository
768 with the newly imported data.</p></div>
769 <div class="paragraph"><p>The fast-import backend itself can import into an empty repository (one that
770 has already been initialized by <em>git init</em>) or incrementally
771 update an existing populated repository. Whether or not incremental
772 imports are supported from a particular foreign source depends on
773 the frontend program in use.</p></div>
774 </div>
775 </div>
776 <div class="sect1">
777 <h2 id="_options">OPTIONS</h2>
778 <div class="sectionbody">
779 <div class="dlist"><dl>
780 <dt class="hdlist1">
781 --force
782 </dt>
783 <dd>
785 Force updating modified existing branches, even if doing
786 so would cause commits to be lost (as the new commit does
787 not contain the old commit).
788 </p>
789 </dd>
790 <dt class="hdlist1">
791 --quiet
792 </dt>
793 <dd>
795 Disable the output shown by --stats, making fast-import usually
796 be silent when it is successful. However, if the import stream
797 has directives intended to show user output (e.g. <code>progress</code>
798 directives), the corresponding messages will still be shown.
799 </p>
800 </dd>
801 <dt class="hdlist1">
802 --stats
803 </dt>
804 <dd>
806 Display some basic statistics about the objects fast-import has
807 created, the packfiles they were stored into, and the
808 memory used by fast-import during this run. Showing this output
809 is currently the default, but can be disabled with --quiet.
810 </p>
811 </dd>
812 <dt class="hdlist1">
813 --allow-unsafe-features
814 </dt>
815 <dd>
817 Many command-line options can be provided as part of the
818 fast-import stream itself by using the <code>feature</code> or <code>option</code>
819 commands. However, some of these options are unsafe (e.g.,
820 allowing fast-import to access the filesystem outside of the
821 repository). These options are disabled by default, but can be
822 allowed by providing this option on the command line. This
823 currently impacts only the <code>export-marks</code>, <code>import-marks</code>, and
824 <code>import-marks-if-exists</code> feature commands.
825 </p>
826 <div class="literalblock">
827 <div class="content">
828 <pre><code>Only enable this option if you trust the program generating the
829 fast-import stream! This option is enabled automatically for
830 remote-helpers that use the `import` capability, as they are
831 already trusted to run their own code.</code></pre>
832 </div></div>
833 </dd>
834 </dl></div>
835 <div class="sect2">
836 <h3 id="_options_for_frontends">Options for Frontends</h3>
837 <div class="dlist"><dl>
838 <dt class="hdlist1">
839 --cat-blob-fd=&lt;fd&gt;
840 </dt>
841 <dd>
843 Write responses to <code>get-mark</code>, <code>cat-blob</code>, and <code>ls</code> queries to the
844 file descriptor &lt;fd&gt; instead of <code>stdout</code>. Allows <code>progress</code>
845 output intended for the end-user to be separated from other
846 output.
847 </p>
848 </dd>
849 <dt class="hdlist1">
850 --date-format=&lt;fmt&gt;
851 </dt>
852 <dd>
854 Specify the type of dates the frontend will supply to
855 fast-import within <code>author</code>, <code>committer</code> and <code>tagger</code> commands.
856 See &#8220;Date Formats&#8221; below for details about which formats
857 are supported, and their syntax.
858 </p>
859 </dd>
860 <dt class="hdlist1">
861 --done
862 </dt>
863 <dd>
865 Terminate with error if there is no <code>done</code> command at the end of
866 the stream. This option might be useful for detecting errors
867 that cause the frontend to terminate before it has started to
868 write a stream.
869 </p>
870 </dd>
871 </dl></div>
872 </div>
873 <div class="sect2">
874 <h3 id="_locations_of_marks_files">Locations of Marks Files</h3>
875 <div class="dlist"><dl>
876 <dt class="hdlist1">
877 --export-marks=&lt;file&gt;
878 </dt>
879 <dd>
881 Dumps the internal marks table to &lt;file&gt; when complete.
882 Marks are written one per line as <code>:markid SHA-1</code>.
883 Frontends can use this file to validate imports after they
884 have been completed, or to save the marks table across
885 incremental runs. As &lt;file&gt; is only opened and truncated
886 at checkpoint (or completion) the same path can also be
887 safely given to --import-marks.
888 </p>
889 </dd>
890 <dt class="hdlist1">
891 --import-marks=&lt;file&gt;
892 </dt>
893 <dd>
895 Before processing any input, load the marks specified in
896 &lt;file&gt;. The input file must exist, must be readable, and
897 must use the same format as produced by --export-marks.
898 Multiple options may be supplied to import more than one
899 set of marks. If a mark is defined to different values,
900 the last file wins.
901 </p>
902 </dd>
903 <dt class="hdlist1">
904 --import-marks-if-exists=&lt;file&gt;
905 </dt>
906 <dd>
908 Like --import-marks but instead of erroring out, silently
909 skips the file if it does not exist.
910 </p>
911 </dd>
912 <dt class="hdlist1">
913 --[no-]relative-marks
914 </dt>
915 <dd>
917 After specifying --relative-marks the paths specified
918 with --import-marks= and --export-marks= are relative
919 to an internal directory in the current repository.
920 In git-fast-import this means that the paths are relative
921 to the .git/info/fast-import directory. However, other
922 importers may use a different location.
923 </p>
924 <div class="paragraph"><p>Relative and non-relative marks may be combined by interweaving
925 --(no-)-relative-marks with the --(import|export)-marks= options.</p></div>
926 </dd>
927 </dl></div>
928 </div>
929 <div class="sect2">
930 <h3 id="_submodule_rewriting">Submodule Rewriting</h3>
931 <div class="dlist"><dl>
932 <dt class="hdlist1">
933 --rewrite-submodules-from=&lt;name&gt;:&lt;file&gt;
934 </dt>
935 <dt class="hdlist1">
936 --rewrite-submodules-to=&lt;name&gt;:&lt;file&gt;
937 </dt>
938 <dd>
940 Rewrite the object IDs for the submodule specified by &lt;name&gt; from the values
941 used in the from &lt;file&gt; to those used in the to &lt;file&gt;. The from marks should
942 have been created by <code>git fast-export</code>, and the to marks should have been
943 created by <code>git fast-import</code> when importing that same submodule.
944 </p>
945 <div class="paragraph"><p>&lt;name&gt; may be any arbitrary string not containing a colon character, but the
946 same value must be used with both options when specifying corresponding marks.
947 Multiple submodules may be specified with different values for &lt;name&gt;. It is an
948 error not to use these options in corresponding pairs.</p></div>
949 <div class="paragraph"><p>These options are primarily useful when converting a repository from one hash
950 algorithm to another; without them, fast-import will fail if it encounters a
951 submodule because it has no way of writing the object ID into the new hash
952 algorithm.</p></div>
953 </dd>
954 </dl></div>
955 </div>
956 <div class="sect2">
957 <h3 id="_performance_and_compression_tuning">Performance and Compression Tuning</h3>
958 <div class="dlist"><dl>
959 <dt class="hdlist1">
960 --active-branches=&lt;n&gt;
961 </dt>
962 <dd>
964 Maximum number of branches to maintain active at once.
965 See &#8220;Memory Utilization&#8221; below for details. Default is 5.
966 </p>
967 </dd>
968 <dt class="hdlist1">
969 --big-file-threshold=&lt;n&gt;
970 </dt>
971 <dd>
973 Maximum size of a blob that fast-import will attempt to
974 create a delta for, expressed in bytes. The default is 512m
975 (512 MiB). Some importers may wish to lower this on systems
976 with constrained memory.
977 </p>
978 </dd>
979 <dt class="hdlist1">
980 --depth=&lt;n&gt;
981 </dt>
982 <dd>
984 Maximum delta depth, for blob and tree deltification.
985 Default is 50.
986 </p>
987 </dd>
988 <dt class="hdlist1">
989 --export-pack-edges=&lt;file&gt;
990 </dt>
991 <dd>
993 After creating a packfile, print a line of data to
994 &lt;file&gt; listing the filename of the packfile and the last
995 commit on each branch that was written to that packfile.
996 This information may be useful after importing projects
997 whose total object set exceeds the 4 GiB packfile limit,
998 as these commits can be used as edge points during calls
999 to <em>git pack-objects</em>.
1000 </p>
1001 </dd>
1002 <dt class="hdlist1">
1003 --max-pack-size=&lt;n&gt;
1004 </dt>
1005 <dd>
1007 Maximum size of each output packfile.
1008 The default is unlimited.
1009 </p>
1010 </dd>
1011 <dt class="hdlist1">
1012 fastimport.unpackLimit
1013 </dt>
1014 <dd>
1016 See <a href="git-config.html">git-config(1)</a>
1017 </p>
1018 </dd>
1019 </dl></div>
1020 </div>
1021 </div>
1022 </div>
1023 <div class="sect1">
1024 <h2 id="_performance">PERFORMANCE</h2>
1025 <div class="sectionbody">
1026 <div class="paragraph"><p>The design of fast-import allows it to import large projects in a minimum
1027 amount of memory usage and processing time. Assuming the frontend
1028 is able to keep up with fast-import and feed it a constant stream of data,
1029 import times for projects holding 10+ years of history and containing
1030 100,000+ individual commits are generally completed in just 1-2
1031 hours on quite modest (~$2,000 USD) hardware.</p></div>
1032 <div class="paragraph"><p>Most bottlenecks appear to be in foreign source data access (the
1033 source just cannot extract revisions fast enough) or disk IO (fast-import
1034 writes as fast as the disk will take the data). Imports will run
1035 faster if the source data is stored on a different drive than the
1036 destination Git repository (due to less IO contention).</p></div>
1037 </div>
1038 </div>
1039 <div class="sect1">
1040 <h2 id="_development_cost">DEVELOPMENT COST</h2>
1041 <div class="sectionbody">
1042 <div class="paragraph"><p>A typical frontend for fast-import tends to weigh in at approximately 200
1043 lines of Perl/Python/Ruby code. Most developers have been able to
1044 create working importers in just a couple of hours, even though it
1045 is their first exposure to fast-import, and sometimes even to Git. This is
1046 an ideal situation, given that most conversion tools are throw-away
1047 (use once, and never look back).</p></div>
1048 </div>
1049 </div>
1050 <div class="sect1">
1051 <h2 id="_parallel_operation">PARALLEL OPERATION</h2>
1052 <div class="sectionbody">
1053 <div class="paragraph"><p>Like <em>git push</em> or <em>git fetch</em>, imports handled by fast-import are safe to
1054 run alongside parallel <code>git repack -a -d</code> or <code>git gc</code> invocations,
1055 or any other Git operation (including <em>git prune</em>, as loose objects
1056 are never used by fast-import).</p></div>
1057 <div class="paragraph"><p>fast-import does not lock the branch or tag refs it is actively importing.
1058 After the import, during its ref update phase, fast-import tests each
1059 existing branch ref to verify the update will be a fast-forward
1060 update (the commit stored in the ref is contained in the new
1061 history of the commit to be written). If the update is not a
1062 fast-forward update, fast-import will skip updating that ref and instead
1063 prints a warning message. fast-import will always attempt to update all
1064 branch refs, and does not stop on the first failure.</p></div>
1065 <div class="paragraph"><p>Branch updates can be forced with --force, but it&#8217;s recommended that
1066 this only be used on an otherwise quiet repository. Using --force
1067 is not necessary for an initial import into an empty repository.</p></div>
1068 </div>
1069 </div>
1070 <div class="sect1">
1071 <h2 id="_technical_discussion">TECHNICAL DISCUSSION</h2>
1072 <div class="sectionbody">
1073 <div class="paragraph"><p>fast-import tracks a set of branches in memory. Any branch can be created
1074 or modified at any point during the import process by sending a
1075 <code>commit</code> command on the input stream. This design allows a frontend
1076 program to process an unlimited number of branches simultaneously,
1077 generating commits in the order they are available from the source
1078 data. It also simplifies the frontend programs considerably.</p></div>
1079 <div class="paragraph"><p>fast-import does not use or alter the current working directory, or any
1080 file within it. (It does however update the current Git repository,
1081 as referenced by <code>GIT_DIR</code>.) Therefore an import frontend may use
1082 the working directory for its own purposes, such as extracting file
1083 revisions from the foreign source. This ignorance of the working
1084 directory also allows fast-import to run very quickly, as it does not
1085 need to perform any costly file update operations when switching
1086 between branches.</p></div>
1087 </div>
1088 </div>
1089 <div class="sect1">
1090 <h2 id="_input_format">INPUT FORMAT</h2>
1091 <div class="sectionbody">
1092 <div class="paragraph"><p>With the exception of raw file data (which Git does not interpret)
1093 the fast-import input format is text (ASCII) based. This text based
1094 format simplifies development and debugging of frontend programs,
1095 especially when a higher level language such as Perl, Python or
1096 Ruby is being used.</p></div>
1097 <div class="paragraph"><p>fast-import is very strict about its input. Where we say SP below we mean
1098 <strong>exactly</strong> one space. Likewise LF means one (and only one) linefeed
1099 and HT one (and only one) horizontal tab.
1100 Supplying additional whitespace characters will cause unexpected
1101 results, such as branch names or file names with leading or trailing
1102 spaces in their name, or early termination of fast-import when it encounters
1103 unexpected input.</p></div>
1104 <div class="sect2">
1105 <h3 id="_stream_comments">Stream Comments</h3>
1106 <div class="paragraph"><p>To aid in debugging frontends fast-import ignores any line that
1107 begins with <code>#</code> (ASCII pound/hash) up to and including the line
1108 ending <code>LF</code>. A comment line may contain any sequence of bytes
1109 that does not contain an LF and therefore may be used to include
1110 any detailed debugging information that might be specific to the
1111 frontend and useful when inspecting a fast-import data stream.</p></div>
1112 </div>
1113 <div class="sect2">
1114 <h3 id="_date_formats">Date Formats</h3>
1115 <div class="paragraph"><p>The following date formats are supported. A frontend should select
1116 the format it will use for this import by passing the format name
1117 in the --date-format=&lt;fmt&gt; command-line option.</p></div>
1118 <div class="dlist"><dl>
1119 <dt class="hdlist1">
1120 <code>raw</code>
1121 </dt>
1122 <dd>
1124 This is the Git native format and is <code>&lt;time&gt; SP &lt;offutc&gt;</code>.
1125 It is also fast-import&#8217;s default format, if --date-format was
1126 not specified.
1127 </p>
1128 <div class="paragraph"><p>The time of the event is specified by <code>&lt;time&gt;</code> as the number of
1129 seconds since the UNIX epoch (midnight, Jan 1, 1970, UTC) and is
1130 written as an ASCII decimal integer.</p></div>
1131 <div class="paragraph"><p>The local offset is specified by <code>&lt;offutc&gt;</code> as a positive or negative
1132 offset from UTC. For example EST (which is 5 hours behind UTC)
1133 would be expressed in <code>&lt;tz&gt;</code> by &#8220;-0500&#8221; while UTC is &#8220;+0000&#8221;.
1134 The local offset does not affect <code>&lt;time&gt;</code>; it is used only as an
1135 advisement to help formatting routines display the timestamp.</p></div>
1136 <div class="paragraph"><p>If the local offset is not available in the source material, use
1137 &#8220;+0000&#8221;, or the most common local offset. For example many
1138 organizations have a CVS repository which has only ever been accessed
1139 by users who are located in the same location and time zone. In this
1140 case a reasonable offset from UTC could be assumed.</p></div>
1141 <div class="paragraph"><p>Unlike the <code>rfc2822</code> format, this format is very strict. Any
1142 variation in formatting will cause fast-import to reject the value,
1143 and some sanity checks on the numeric values may also be performed.</p></div>
1144 </dd>
1145 <dt class="hdlist1">
1146 <code>raw-permissive</code>
1147 </dt>
1148 <dd>
1150 This is the same as <code>raw</code> except that no sanity checks on
1151 the numeric epoch and local offset are performed. This can
1152 be useful when trying to filter or import an existing history
1153 with e.g. bogus timezone values.
1154 </p>
1155 </dd>
1156 <dt class="hdlist1">
1157 <code>rfc2822</code>
1158 </dt>
1159 <dd>
1161 This is the standard date format as described by RFC 2822.
1162 </p>
1163 <div class="paragraph"><p>An example value is &#8220;Tue Feb 6 11:22:18 2007 -0500&#8221;. The Git
1164 parser is accurate, but a little on the lenient side. It is the
1165 same parser used by <em>git am</em> when applying patches
1166 received from email.</p></div>
1167 <div class="paragraph"><p>Some malformed strings may be accepted as valid dates. In some of
1168 these cases Git will still be able to obtain the correct date from
1169 the malformed string. There are also some types of malformed
1170 strings which Git will parse wrong, and yet consider valid.
1171 Seriously malformed strings will be rejected.</p></div>
1172 <div class="paragraph"><p>Unlike the <code>raw</code> format above, the time zone/UTC offset information
1173 contained in an RFC 2822 date string is used to adjust the date
1174 value to UTC prior to storage. Therefore it is important that
1175 this information be as accurate as possible.</p></div>
1176 <div class="paragraph"><p>If the source material uses RFC 2822 style dates,
1177 the frontend should let fast-import handle the parsing and conversion
1178 (rather than attempting to do it itself) as the Git parser has
1179 been well tested in the wild.</p></div>
1180 <div class="paragraph"><p>Frontends should prefer the <code>raw</code> format if the source material
1181 already uses UNIX-epoch format, can be coaxed to give dates in that
1182 format, or its format is easily convertible to it, as there is no
1183 ambiguity in parsing.</p></div>
1184 </dd>
1185 <dt class="hdlist1">
1186 <code>now</code>
1187 </dt>
1188 <dd>
1190 Always use the current time and time zone. The literal
1191 <code>now</code> must always be supplied for <code>&lt;when&gt;</code>.
1192 </p>
1193 <div class="paragraph"><p>This is a toy format. The current time and time zone of this system
1194 is always copied into the identity string at the time it is being
1195 created by fast-import. There is no way to specify a different time or
1196 time zone.</p></div>
1197 <div class="paragraph"><p>This particular format is supplied as it&#8217;s short to implement and
1198 may be useful to a process that wants to create a new commit
1199 right now, without needing to use a working directory or
1200 <em>git update-index</em>.</p></div>
1201 <div class="paragraph"><p>If separate <code>author</code> and <code>committer</code> commands are used in a <code>commit</code>
1202 the timestamps may not match, as the system clock will be polled
1203 twice (once for each command). The only way to ensure that both
1204 author and committer identity information has the same timestamp
1205 is to omit <code>author</code> (thus copying from <code>committer</code>) or to use a
1206 date format other than <code>now</code>.</p></div>
1207 </dd>
1208 </dl></div>
1209 </div>
1210 <div class="sect2">
1211 <h3 id="_commands">Commands</h3>
1212 <div class="paragraph"><p>fast-import accepts several commands to update the current repository
1213 and control the current import process. More detailed discussion
1214 (with examples) of each command follows later.</p></div>
1215 <div class="dlist"><dl>
1216 <dt class="hdlist1">
1217 <code>commit</code>
1218 </dt>
1219 <dd>
1221 Creates a new branch or updates an existing branch by
1222 creating a new commit and updating the branch to point at
1223 the newly created commit.
1224 </p>
1225 </dd>
1226 <dt class="hdlist1">
1227 <code>tag</code>
1228 </dt>
1229 <dd>
1231 Creates an annotated tag object from an existing commit or
1232 branch. Lightweight tags are not supported by this command,
1233 as they are not recommended for recording meaningful points
1234 in time.
1235 </p>
1236 </dd>
1237 <dt class="hdlist1">
1238 <code>reset</code>
1239 </dt>
1240 <dd>
1242 Reset an existing branch (or a new branch) to a specific
1243 revision. This command must be used to change a branch to
1244 a specific revision without making a commit on it.
1245 </p>
1246 </dd>
1247 <dt class="hdlist1">
1248 <code>blob</code>
1249 </dt>
1250 <dd>
1252 Convert raw file data into a blob, for future use in a
1253 <code>commit</code> command. This command is optional and is not
1254 needed to perform an import.
1255 </p>
1256 </dd>
1257 <dt class="hdlist1">
1258 <code>alias</code>
1259 </dt>
1260 <dd>
1262 Record that a mark refers to a given object without first
1263 creating any new object. Using --import-marks and referring
1264 to missing marks will cause fast-import to fail, so aliases
1265 can provide a way to set otherwise pruned commits to a valid
1266 value (e.g. the nearest non-pruned ancestor).
1267 </p>
1268 </dd>
1269 <dt class="hdlist1">
1270 <code>checkpoint</code>
1271 </dt>
1272 <dd>
1274 Forces fast-import to close the current packfile, generate its
1275 unique SHA-1 checksum and index, and start a new packfile.
1276 This command is optional and is not needed to perform
1277 an import.
1278 </p>
1279 </dd>
1280 <dt class="hdlist1">
1281 <code>progress</code>
1282 </dt>
1283 <dd>
1285 Causes fast-import to echo the entire line to its own
1286 standard output. This command is optional and is not needed
1287 to perform an import.
1288 </p>
1289 </dd>
1290 <dt class="hdlist1">
1291 <code>done</code>
1292 </dt>
1293 <dd>
1295 Marks the end of the stream. This command is optional
1296 unless the <code>done</code> feature was requested using the
1297 <code>--done</code> command-line option or <code>feature done</code> command.
1298 </p>
1299 </dd>
1300 <dt class="hdlist1">
1301 <code>get-mark</code>
1302 </dt>
1303 <dd>
1305 Causes fast-import to print the SHA-1 corresponding to a mark
1306 to the file descriptor set with <code>--cat-blob-fd</code>, or <code>stdout</code> if
1307 unspecified.
1308 </p>
1309 </dd>
1310 <dt class="hdlist1">
1311 <code>cat-blob</code>
1312 </dt>
1313 <dd>
1315 Causes fast-import to print a blob in <em>cat-file --batch</em>
1316 format to the file descriptor set with <code>--cat-blob-fd</code> or
1317 <code>stdout</code> if unspecified.
1318 </p>
1319 </dd>
1320 <dt class="hdlist1">
1321 <code>ls</code>
1322 </dt>
1323 <dd>
1325 Causes fast-import to print a line describing a directory
1326 entry in <em>ls-tree</em> format to the file descriptor set with
1327 <code>--cat-blob-fd</code> or <code>stdout</code> if unspecified.
1328 </p>
1329 </dd>
1330 <dt class="hdlist1">
1331 <code>feature</code>
1332 </dt>
1333 <dd>
1335 Enable the specified feature. This requires that fast-import
1336 supports the specified feature, and aborts if it does not.
1337 </p>
1338 </dd>
1339 <dt class="hdlist1">
1340 <code>option</code>
1341 </dt>
1342 <dd>
1344 Specify any of the options listed under OPTIONS that do not
1345 change stream semantic to suit the frontend&#8217;s needs. This
1346 command is optional and is not needed to perform an import.
1347 </p>
1348 </dd>
1349 </dl></div>
1350 </div>
1351 <div class="sect2">
1352 <h3 id="_code_commit_code"><code>commit</code></h3>
1353 <div class="paragraph"><p>Create or update a branch with a new commit, recording one logical
1354 change to the project.</p></div>
1355 <div class="literalblock">
1356 <div class="content">
1357 <pre><code> 'commit' SP &lt;ref&gt; LF
1358 mark?
1359 original-oid?
1360 ('author' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF)?
1361 'committer' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF
1362 ('encoding' SP &lt;encoding&gt;)?
1363 data
1364 ('from' SP &lt;commit-ish&gt; LF)?
1365 ('merge' SP &lt;commit-ish&gt; LF)*
1366 (filemodify | filedelete | filecopy | filerename | filedeleteall | notemodify)*
1367 LF?</code></pre>
1368 </div></div>
1369 <div class="paragraph"><p>where <code>&lt;ref&gt;</code> is the name of the branch to make the commit on.
1370 Typically branch names are prefixed with <code>refs/heads/</code> in
1371 Git, so importing the CVS branch symbol <code>RELENG-1_0</code> would use
1372 <code>refs/heads/RELENG-1_0</code> for the value of <code>&lt;ref&gt;</code>. The value of
1373 <code>&lt;ref&gt;</code> must be a valid refname in Git. As <code>LF</code> is not valid in
1374 a Git refname, no quoting or escaping syntax is supported here.</p></div>
1375 <div class="paragraph"><p>A <code>mark</code> command may optionally appear, requesting fast-import to save a
1376 reference to the newly created commit for future use by the frontend
1377 (see below for format). It is very common for frontends to mark
1378 every commit they create, thereby allowing future branch creation
1379 from any imported commit.</p></div>
1380 <div class="paragraph"><p>The <code>data</code> command following <code>committer</code> must supply the commit
1381 message (see below for <code>data</code> command syntax). To import an empty
1382 commit message use a 0 length data. Commit messages are free-form
1383 and are not interpreted by Git. Currently they must be encoded in
1384 UTF-8, as fast-import does not permit other encodings to be specified.</p></div>
1385 <div class="paragraph"><p>Zero or more <code>filemodify</code>, <code>filedelete</code>, <code>filecopy</code>, <code>filerename</code>,
1386 <code>filedeleteall</code> and <code>notemodify</code> commands
1387 may be included to update the contents of the branch prior to
1388 creating the commit. These commands may be supplied in any order.
1389 However it is recommended that a <code>filedeleteall</code> command precede
1390 all <code>filemodify</code>, <code>filecopy</code>, <code>filerename</code> and <code>notemodify</code> commands in
1391 the same commit, as <code>filedeleteall</code> wipes the branch clean (see below).</p></div>
1392 <div class="paragraph"><p>The <code>LF</code> after the command is optional (it used to be required). Note
1393 that for reasons of backward compatibility, if the commit ends with a
1394 <code>data</code> command (i.e. it has no <code>from</code>, <code>merge</code>, <code>filemodify</code>,
1395 <code>filedelete</code>, <code>filecopy</code>, <code>filerename</code>, <code>filedeleteall</code> or
1396 <code>notemodify</code> commands) then two <code>LF</code> commands may appear at the end of
1397 the command instead of just one.</p></div>
1398 <div class="sect3">
1399 <h4 id="_code_author_code"><code>author</code></h4>
1400 <div class="paragraph"><p>An <code>author</code> command may optionally appear, if the author information
1401 might differ from the committer information. If <code>author</code> is omitted
1402 then fast-import will automatically use the committer&#8217;s information for
1403 the author portion of the commit. See below for a description of
1404 the fields in <code>author</code>, as they are identical to <code>committer</code>.</p></div>
1405 </div>
1406 <div class="sect3">
1407 <h4 id="_code_committer_code"><code>committer</code></h4>
1408 <div class="paragraph"><p>The <code>committer</code> command indicates who made this commit, and when
1409 they made it.</p></div>
1410 <div class="paragraph"><p>Here <code>&lt;name&gt;</code> is the person&#8217;s display name (for example
1411 &#8220;Com M Itter&#8221;) and <code>&lt;email&gt;</code> is the person&#8217;s email address
1412 (&#8220;cm@example.com&#8221;). <code>LT</code> and <code>GT</code> are the literal less-than (\x3c)
1413 and greater-than (\x3e) symbols. These are required to delimit
1414 the email address from the other fields in the line. Note that
1415 <code>&lt;name&gt;</code> and <code>&lt;email&gt;</code> are free-form and may contain any sequence
1416 of bytes, except <code>LT</code>, <code>GT</code> and <code>LF</code>. <code>&lt;name&gt;</code> is typically UTF-8 encoded.</p></div>
1417 <div class="paragraph"><p>The time of the change is specified by <code>&lt;when&gt;</code> using the date format
1418 that was selected by the --date-format=&lt;fmt&gt; command-line option.
1419 See &#8220;Date Formats&#8221; above for the set of supported formats, and
1420 their syntax.</p></div>
1421 </div>
1422 <div class="sect3">
1423 <h4 id="_code_encoding_code"><code>encoding</code></h4>
1424 <div class="paragraph"><p>The optional <code>encoding</code> command indicates the encoding of the commit
1425 message. Most commits are UTF-8 and the encoding is omitted, but this
1426 allows importing commit messages into git without first reencoding them.</p></div>
1427 </div>
1428 <div class="sect3">
1429 <h4 id="_code_from_code"><code>from</code></h4>
1430 <div class="paragraph"><p>The <code>from</code> command is used to specify the commit to initialize
1431 this branch from. This revision will be the first ancestor of the
1432 new commit. The state of the tree built at this commit will begin
1433 with the state at the <code>from</code> commit, and be altered by the content
1434 modifications in this commit.</p></div>
1435 <div class="paragraph"><p>Omitting the <code>from</code> command in the first commit of a new branch
1436 will cause fast-import to create that commit with no ancestor. This
1437 tends to be desired only for the initial commit of a project.
1438 If the frontend creates all files from scratch when making a new
1439 branch, a <code>merge</code> command may be used instead of <code>from</code> to start
1440 the commit with an empty tree.
1441 Omitting the <code>from</code> command on existing branches is usually desired,
1442 as the current commit on that branch is automatically assumed to
1443 be the first ancestor of the new commit.</p></div>
1444 <div class="paragraph"><p>As <code>LF</code> is not valid in a Git refname or SHA-1 expression, no
1445 quoting or escaping syntax is supported within <code>&lt;commit-ish&gt;</code>.</p></div>
1446 <div class="paragraph"><p>Here <code>&lt;commit-ish&gt;</code> is any of the following:</p></div>
1447 <div class="ulist"><ul>
1448 <li>
1450 The name of an existing branch already in fast-import&#8217;s internal branch
1451 table. If fast-import doesn&#8217;t know the name, it&#8217;s treated as a SHA-1
1452 expression.
1453 </p>
1454 </li>
1455 <li>
1457 A mark reference, <code>:&lt;idnum&gt;</code>, where <code>&lt;idnum&gt;</code> is the mark number.
1458 </p>
1459 <div class="paragraph"><p>The reason fast-import uses <code>:</code> to denote a mark reference is this character
1460 is not legal in a Git branch name. The leading <code>:</code> makes it easy
1461 to distinguish between the mark 42 (<code>:42</code>) and the branch 42 (<code>42</code>
1462 or <code>refs/heads/42</code>), or an abbreviated SHA-1 which happened to
1463 consist only of base-10 digits.</p></div>
1464 <div class="paragraph"><p>Marks must be declared (via <code>mark</code>) before they can be used.</p></div>
1465 </li>
1466 <li>
1468 A complete 40 byte or abbreviated commit SHA-1 in hex.
1469 </p>
1470 </li>
1471 <li>
1473 Any valid Git SHA-1 expression that resolves to a commit. See
1474 &#8220;SPECIFYING REVISIONS&#8221; in <a href="gitrevisions.html">gitrevisions(7)</a> for details.
1475 </p>
1476 </li>
1477 <li>
1479 The special null SHA-1 (40 zeros) specifies that the branch is to be
1480 removed.
1481 </p>
1482 </li>
1483 </ul></div>
1484 <div class="paragraph"><p>The special case of restarting an incremental import from the
1485 current branch value should be written as:</p></div>
1486 <div class="listingblock">
1487 <div class="content">
1488 <pre><code> from refs/heads/branch^0</code></pre>
1489 </div></div>
1490 <div class="paragraph"><p>The <code>^0</code> suffix is necessary as fast-import does not permit a branch to
1491 start from itself, and the branch is created in memory before the
1492 <code>from</code> command is even read from the input. Adding <code>^0</code> will force
1493 fast-import to resolve the commit through Git&#8217;s revision parsing library,
1494 rather than its internal branch table, thereby loading in the
1495 existing value of the branch.</p></div>
1496 </div>
1497 <div class="sect3">
1498 <h4 id="_code_merge_code"><code>merge</code></h4>
1499 <div class="paragraph"><p>Includes one additional ancestor commit. The additional ancestry
1500 link does not change the way the tree state is built at this commit.
1501 If the <code>from</code> command is
1502 omitted when creating a new branch, the first <code>merge</code> commit will be
1503 the first ancestor of the current commit, and the branch will start
1504 out with no files. An unlimited number of <code>merge</code> commands per
1505 commit are permitted by fast-import, thereby establishing an n-way merge.</p></div>
1506 <div class="paragraph"><p>Here <code>&lt;commit-ish&gt;</code> is any of the commit specification expressions
1507 also accepted by <code>from</code> (see above).</p></div>
1508 </div>
1509 <div class="sect3">
1510 <h4 id="_code_filemodify_code"><code>filemodify</code></h4>
1511 <div class="paragraph"><p>Included in a <code>commit</code> command to add a new file or change the
1512 content of an existing file. This command has two different means
1513 of specifying the content of the file.</p></div>
1514 <div class="dlist"><dl>
1515 <dt class="hdlist1">
1516 External data format
1517 </dt>
1518 <dd>
1520 The data content for the file was already supplied by a prior
1521 <code>blob</code> command. The frontend just needs to connect it.
1522 </p>
1523 <div class="literalblock">
1524 <div class="content">
1525 <pre><code> 'M' SP &lt;mode&gt; SP &lt;dataref&gt; SP &lt;path&gt; LF</code></pre>
1526 </div></div>
1527 <div class="paragraph"><p>Here usually <code>&lt;dataref&gt;</code> must be either a mark reference (<code>:&lt;idnum&gt;</code>)
1528 set by a prior <code>blob</code> command, or a full 40-byte SHA-1 of an
1529 existing Git blob object. If <code>&lt;mode&gt;</code> is <code>040000`</code> then
1530 <code>&lt;dataref&gt;</code> must be the full 40-byte SHA-1 of an existing
1531 Git tree object or a mark reference set with <code>--import-marks</code>.</p></div>
1532 </dd>
1533 <dt class="hdlist1">
1534 Inline data format
1535 </dt>
1536 <dd>
1538 The data content for the file has not been supplied yet.
1539 The frontend wants to supply it as part of this modify
1540 command.
1541 </p>
1542 <div class="literalblock">
1543 <div class="content">
1544 <pre><code> 'M' SP &lt;mode&gt; SP 'inline' SP &lt;path&gt; LF
1545 data</code></pre>
1546 </div></div>
1547 <div class="paragraph"><p>See below for a detailed description of the <code>data</code> command.</p></div>
1548 </dd>
1549 </dl></div>
1550 <div class="paragraph"><p>In both formats <code>&lt;mode&gt;</code> is the type of file entry, specified
1551 in octal. Git only supports the following modes:</p></div>
1552 <div class="ulist"><ul>
1553 <li>
1555 <code>100644</code> or <code>644</code>: A normal (not-executable) file. The majority
1556 of files in most projects use this mode. If in doubt, this is
1557 what you want.
1558 </p>
1559 </li>
1560 <li>
1562 <code>100755</code> or <code>755</code>: A normal, but executable, file.
1563 </p>
1564 </li>
1565 <li>
1567 <code>120000</code>: A symlink, the content of the file will be the link target.
1568 </p>
1569 </li>
1570 <li>
1572 <code>160000</code>: A gitlink, SHA-1 of the object refers to a commit in
1573 another repository. Git links can only be specified either by SHA or through
1574 a commit mark. They are used to implement submodules.
1575 </p>
1576 </li>
1577 <li>
1579 <code>040000</code>: A subdirectory. Subdirectories can only be specified by
1580 SHA or through a tree mark set with <code>--import-marks</code>.
1581 </p>
1582 </li>
1583 </ul></div>
1584 <div class="paragraph"><p>In both formats <code>&lt;path&gt;</code> is the complete path of the file to be added
1585 (if not already existing) or modified (if already existing).</p></div>
1586 <div class="paragraph"><p>A <code>&lt;path&gt;</code> can be written as unquoted bytes or a C-style quoted string.</p></div>
1587 <div class="paragraph"><p>When a <code>&lt;path&gt;</code> does not start with a double quote (<code>"</code>), it is an
1588 unquoted string and is parsed as literal bytes without any escape
1589 sequences. However, if the filename contains <code>LF</code> or starts with double
1590 quote, it cannot be represented as an unquoted string and must be
1591 quoted. Additionally, the source <code>&lt;path&gt;</code> in <code>filecopy</code> or <code>filerename</code>
1592 must be quoted if it contains SP.</p></div>
1593 <div class="paragraph"><p>When a <code>&lt;path&gt;</code> starts with a double quote (<code>"</code>), it is a C-style quoted
1594 string, where the complete filename is enclosed in a pair of double
1595 quotes and escape sequences are used. Certain characters must be escaped
1596 by preceding them with a backslash: <code>LF</code> is written as <code>\n</code>, backslash
1597 as <code>\\</code>, and double quote as <code>\"</code>. Some characters may optionally be
1598 written with escape sequences: <code>\a</code> for bell, <code>\b</code> for backspace, <code>\f</code>
1599 for form feed, <code>\n</code> for line feed, <code>\r</code> for carriage return, <code>\t</code> for
1600 horizontal tab, and <code>\v</code> for vertical tab. Any byte can be written with
1601 3-digit octal codes (e.g., <code>\033</code>). All filenames can be represented as
1602 quoted strings.</p></div>
1603 <div class="paragraph"><p>A <code>&lt;path&gt;</code> must use UNIX-style directory separators (forward slash <code>/</code>)
1604 and its value must be in canonical form. That is it must not:</p></div>
1605 <div class="ulist"><ul>
1606 <li>
1608 contain an empty directory component (e.g. <code>foo//bar</code> is invalid),
1609 </p>
1610 </li>
1611 <li>
1613 end with a directory separator (e.g. <code>foo/</code> is invalid),
1614 </p>
1615 </li>
1616 <li>
1618 start with a directory separator (e.g. <code>/foo</code> is invalid),
1619 </p>
1620 </li>
1621 <li>
1623 contain the special component <code>.</code> or <code>..</code> (e.g. <code>foo/./bar</code> and
1624 <code>foo/../bar</code> are invalid).
1625 </p>
1626 </li>
1627 </ul></div>
1628 <div class="paragraph"><p>The root of the tree can be represented by an empty string as <code>&lt;path&gt;</code>.</p></div>
1629 <div class="paragraph"><p><code>&lt;path&gt;</code> cannot contain NUL, either literally or escaped as <code>\000</code>.
1630 It is recommended that <code>&lt;path&gt;</code> always be encoded using UTF-8.</p></div>
1631 </div>
1632 <div class="sect3">
1633 <h4 id="_code_filedelete_code"><code>filedelete</code></h4>
1634 <div class="paragraph"><p>Included in a <code>commit</code> command to remove a file or recursively
1635 delete an entire directory from the branch. If the file or directory
1636 removal makes its parent directory empty, the parent directory will
1637 be automatically removed too. This cascades up the tree until the
1638 first non-empty directory or the root is reached.</p></div>
1639 <div class="literalblock">
1640 <div class="content">
1641 <pre><code> 'D' SP &lt;path&gt; LF</code></pre>
1642 </div></div>
1643 <div class="paragraph"><p>here <code>&lt;path&gt;</code> is the complete path of the file or subdirectory to
1644 be removed from the branch.
1645 See <code>filemodify</code> above for a detailed description of <code>&lt;path&gt;</code>.</p></div>
1646 </div>
1647 <div class="sect3">
1648 <h4 id="_code_filecopy_code"><code>filecopy</code></h4>
1649 <div class="paragraph"><p>Recursively copies an existing file or subdirectory to a different
1650 location within the branch. The existing file or directory must
1651 exist. If the destination exists it will be completely replaced
1652 by the content copied from the source.</p></div>
1653 <div class="literalblock">
1654 <div class="content">
1655 <pre><code> 'C' SP &lt;path&gt; SP &lt;path&gt; LF</code></pre>
1656 </div></div>
1657 <div class="paragraph"><p>here the first <code>&lt;path&gt;</code> is the source location and the second
1658 <code>&lt;path&gt;</code> is the destination. See <code>filemodify</code> above for a detailed
1659 description of what <code>&lt;path&gt;</code> may look like. To use a source path
1660 that contains SP the path must be quoted.</p></div>
1661 <div class="paragraph"><p>A <code>filecopy</code> command takes effect immediately. Once the source
1662 location has been copied to the destination any future commands
1663 applied to the source location will not impact the destination of
1664 the copy.</p></div>
1665 </div>
1666 <div class="sect3">
1667 <h4 id="_code_filerename_code"><code>filerename</code></h4>
1668 <div class="paragraph"><p>Renames an existing file or subdirectory to a different location
1669 within the branch. The existing file or directory must exist. If
1670 the destination exists it will be replaced by the source directory.</p></div>
1671 <div class="literalblock">
1672 <div class="content">
1673 <pre><code> 'R' SP &lt;path&gt; SP &lt;path&gt; LF</code></pre>
1674 </div></div>
1675 <div class="paragraph"><p>here the first <code>&lt;path&gt;</code> is the source location and the second
1676 <code>&lt;path&gt;</code> is the destination. See <code>filemodify</code> above for a detailed
1677 description of what <code>&lt;path&gt;</code> may look like. To use a source path
1678 that contains SP the path must be quoted.</p></div>
1679 <div class="paragraph"><p>A <code>filerename</code> command takes effect immediately. Once the source
1680 location has been renamed to the destination any future commands
1681 applied to the source location will create new files there and not
1682 impact the destination of the rename.</p></div>
1683 <div class="paragraph"><p>Note that a <code>filerename</code> is the same as a <code>filecopy</code> followed by a
1684 <code>filedelete</code> of the source location. There is a slight performance
1685 advantage to using <code>filerename</code>, but the advantage is so small
1686 that it is never worth trying to convert a delete/add pair in
1687 source material into a rename for fast-import. This <code>filerename</code>
1688 command is provided just to simplify frontends that already have
1689 rename information and don&#8217;t want bother with decomposing it into a
1690 <code>filecopy</code> followed by a <code>filedelete</code>.</p></div>
1691 </div>
1692 <div class="sect3">
1693 <h4 id="_code_filedeleteall_code"><code>filedeleteall</code></h4>
1694 <div class="paragraph"><p>Included in a <code>commit</code> command to remove all files (and also all
1695 directories) from the branch. This command resets the internal
1696 branch structure to have no files in it, allowing the frontend
1697 to subsequently add all interesting files from scratch.</p></div>
1698 <div class="literalblock">
1699 <div class="content">
1700 <pre><code> 'deleteall' LF</code></pre>
1701 </div></div>
1702 <div class="paragraph"><p>This command is extremely useful if the frontend does not know
1703 (or does not care to know) what files are currently on the branch,
1704 and therefore cannot generate the proper <code>filedelete</code> commands to
1705 update the content.</p></div>
1706 <div class="paragraph"><p>Issuing a <code>filedeleteall</code> followed by the needed <code>filemodify</code>
1707 commands to set the correct content will produce the same results
1708 as sending only the needed <code>filemodify</code> and <code>filedelete</code> commands.
1709 The <code>filedeleteall</code> approach may however require fast-import to use slightly
1710 more memory per active branch (less than 1 MiB for even most large
1711 projects); so frontends that can easily obtain only the affected
1712 paths for a commit are encouraged to do so.</p></div>
1713 </div>
1714 <div class="sect3">
1715 <h4 id="_code_notemodify_code"><code>notemodify</code></h4>
1716 <div class="paragraph"><p>Included in a <code>commit</code> <code>&lt;notes-ref&gt;</code> command to add a new note
1717 annotating a <code>&lt;commit-ish&gt;</code> or change this annotation contents.
1718 Internally it is similar to filemodify 100644 on <code>&lt;commit-ish&gt;</code>
1719 path (maybe split into subdirectories). It&#8217;s not advised to
1720 use any other commands to write to the <code>&lt;notes-ref&gt;</code> tree except
1721 <code>filedeleteall</code> to delete all existing notes in this tree.
1722 This command has two different means of specifying the content
1723 of the note.</p></div>
1724 <div class="dlist"><dl>
1725 <dt class="hdlist1">
1726 External data format
1727 </dt>
1728 <dd>
1730 The data content for the note was already supplied by a prior
1731 <code>blob</code> command. The frontend just needs to connect it to the
1732 commit that is to be annotated.
1733 </p>
1734 <div class="literalblock">
1735 <div class="content">
1736 <pre><code> 'N' SP &lt;dataref&gt; SP &lt;commit-ish&gt; LF</code></pre>
1737 </div></div>
1738 <div class="paragraph"><p>Here <code>&lt;dataref&gt;</code> can be either a mark reference (<code>:&lt;idnum&gt;</code>)
1739 set by a prior <code>blob</code> command, or a full 40-byte SHA-1 of an
1740 existing Git blob object.</p></div>
1741 </dd>
1742 <dt class="hdlist1">
1743 Inline data format
1744 </dt>
1745 <dd>
1747 The data content for the note has not been supplied yet.
1748 The frontend wants to supply it as part of this modify
1749 command.
1750 </p>
1751 <div class="literalblock">
1752 <div class="content">
1753 <pre><code> 'N' SP 'inline' SP &lt;commit-ish&gt; LF
1754 data</code></pre>
1755 </div></div>
1756 <div class="paragraph"><p>See below for a detailed description of the <code>data</code> command.</p></div>
1757 </dd>
1758 </dl></div>
1759 <div class="paragraph"><p>In both formats <code>&lt;commit-ish&gt;</code> is any of the commit specification
1760 expressions also accepted by <code>from</code> (see above).</p></div>
1761 </div>
1762 </div>
1763 <div class="sect2">
1764 <h3 id="_code_mark_code"><code>mark</code></h3>
1765 <div class="paragraph"><p>Arranges for fast-import to save a reference to the current object, allowing
1766 the frontend to recall this object at a future point in time, without
1767 knowing its SHA-1. Here the current object is the object creation
1768 command the <code>mark</code> command appears within. This can be <code>commit</code>,
1769 <code>tag</code>, and <code>blob</code>, but <code>commit</code> is the most common usage.</p></div>
1770 <div class="literalblock">
1771 <div class="content">
1772 <pre><code> 'mark' SP ':' &lt;idnum&gt; LF</code></pre>
1773 </div></div>
1774 <div class="paragraph"><p>where <code>&lt;idnum&gt;</code> is the number assigned by the frontend to this mark.
1775 The value of <code>&lt;idnum&gt;</code> is expressed as an ASCII decimal integer.
1776 The value 0 is reserved and cannot be used as
1777 a mark. Only values greater than or equal to 1 may be used as marks.</p></div>
1778 <div class="paragraph"><p>New marks are created automatically. Existing marks can be moved
1779 to another object simply by reusing the same <code>&lt;idnum&gt;</code> in another
1780 <code>mark</code> command.</p></div>
1781 </div>
1782 <div class="sect2">
1783 <h3 id="_code_original_oid_code"><code>original-oid</code></h3>
1784 <div class="paragraph"><p>Provides the name of the object in the original source control system.
1785 fast-import will simply ignore this directive, but filter processes
1786 which operate on and modify the stream before feeding to fast-import
1787 may have uses for this information</p></div>
1788 <div class="literalblock">
1789 <div class="content">
1790 <pre><code> 'original-oid' SP &lt;object-identifier&gt; LF</code></pre>
1791 </div></div>
1792 <div class="paragraph"><p>where <code>&lt;object-identifier&gt;</code> is any string not containing LF.</p></div>
1793 </div>
1794 <div class="sect2">
1795 <h3 id="_code_tag_code"><code>tag</code></h3>
1796 <div class="paragraph"><p>Creates an annotated tag referring to a specific commit. To create
1797 lightweight (non-annotated) tags see the <code>reset</code> command below.</p></div>
1798 <div class="literalblock">
1799 <div class="content">
1800 <pre><code> 'tag' SP &lt;name&gt; LF
1801 mark?
1802 'from' SP &lt;commit-ish&gt; LF
1803 original-oid?
1804 'tagger' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF
1805 data</code></pre>
1806 </div></div>
1807 <div class="paragraph"><p>where <code>&lt;name&gt;</code> is the name of the tag to create.</p></div>
1808 <div class="paragraph"><p>Tag names are automatically prefixed with <code>refs/tags/</code> when stored
1809 in Git, so importing the CVS branch symbol <code>RELENG-1_0-FINAL</code> would
1810 use just <code>RELENG-1_0-FINAL</code> for <code>&lt;name&gt;</code>, and fast-import will write the
1811 corresponding ref as <code>refs/tags/RELENG-1_0-FINAL</code>.</p></div>
1812 <div class="paragraph"><p>The value of <code>&lt;name&gt;</code> must be a valid refname in Git and therefore
1813 may contain forward slashes. As <code>LF</code> is not valid in a Git refname,
1814 no quoting or escaping syntax is supported here.</p></div>
1815 <div class="paragraph"><p>The <code>from</code> command is the same as in the <code>commit</code> command; see
1816 above for details.</p></div>
1817 <div class="paragraph"><p>The <code>tagger</code> command uses the same format as <code>committer</code> within
1818 <code>commit</code>; again see above for details.</p></div>
1819 <div class="paragraph"><p>The <code>data</code> command following <code>tagger</code> must supply the annotated tag
1820 message (see below for <code>data</code> command syntax). To import an empty
1821 tag message use a 0 length data. Tag messages are free-form and are
1822 not interpreted by Git. Currently they must be encoded in UTF-8,
1823 as fast-import does not permit other encodings to be specified.</p></div>
1824 <div class="paragraph"><p>Signing annotated tags during import from within fast-import is not
1825 supported. Trying to include your own PGP/GPG signature is not
1826 recommended, as the frontend does not (easily) have access to the
1827 complete set of bytes which normally goes into such a signature.
1828 If signing is required, create lightweight tags from within fast-import with
1829 <code>reset</code>, then create the annotated versions of those tags offline
1830 with the standard <em>git tag</em> process.</p></div>
1831 </div>
1832 <div class="sect2">
1833 <h3 id="_code_reset_code"><code>reset</code></h3>
1834 <div class="paragraph"><p>Creates (or recreates) the named branch, optionally starting from
1835 a specific revision. The reset command allows a frontend to issue
1836 a new <code>from</code> command for an existing branch, or to create a new
1837 branch from an existing commit without creating a new commit.</p></div>
1838 <div class="literalblock">
1839 <div class="content">
1840 <pre><code> 'reset' SP &lt;ref&gt; LF
1841 ('from' SP &lt;commit-ish&gt; LF)?
1842 LF?</code></pre>
1843 </div></div>
1844 <div class="paragraph"><p>For a detailed description of <code>&lt;ref&gt;</code> and <code>&lt;commit-ish&gt;</code> see above
1845 under <code>commit</code> and <code>from</code>.</p></div>
1846 <div class="paragraph"><p>The <code>LF</code> after the command is optional (it used to be required).</p></div>
1847 <div class="paragraph"><p>The <code>reset</code> command can also be used to create lightweight
1848 (non-annotated) tags. For example:</p></div>
1849 <div class="exampleblock">
1850 <div class="content">
1851 <div class="literalblock">
1852 <div class="content">
1853 <pre><code>reset refs/tags/938
1854 from :938</code></pre>
1855 </div></div>
1856 </div></div>
1857 <div class="paragraph"><p>would create the lightweight tag <code>refs/tags/938</code> referring to
1858 whatever commit mark <code>:938</code> references.</p></div>
1859 </div>
1860 <div class="sect2">
1861 <h3 id="_code_blob_code"><code>blob</code></h3>
1862 <div class="paragraph"><p>Requests writing one file revision to the packfile. The revision
1863 is not connected to any commit; this connection must be formed in
1864 a subsequent <code>commit</code> command by referencing the blob through an
1865 assigned mark.</p></div>
1866 <div class="literalblock">
1867 <div class="content">
1868 <pre><code> 'blob' LF
1869 mark?
1870 original-oid?
1871 data</code></pre>
1872 </div></div>
1873 <div class="paragraph"><p>The mark command is optional here as some frontends have chosen
1874 to generate the Git SHA-1 for the blob on their own, and feed that
1875 directly to <code>commit</code>. This is typically more work than it&#8217;s worth
1876 however, as marks are inexpensive to store and easy to use.</p></div>
1877 </div>
1878 <div class="sect2">
1879 <h3 id="_code_data_code"><code>data</code></h3>
1880 <div class="paragraph"><p>Supplies raw data (for use as blob/file content, commit messages, or
1881 annotated tag messages) to fast-import. Data can be supplied using an exact
1882 byte count or delimited with a terminating line. Real frontends
1883 intended for production-quality conversions should always use the
1884 exact byte count format, as it is more robust and performs better.
1885 The delimited format is intended primarily for testing fast-import.</p></div>
1886 <div class="paragraph"><p>Comment lines appearing within the <code>&lt;raw&gt;</code> part of <code>data</code> commands
1887 are always taken to be part of the body of the data and are therefore
1888 never ignored by fast-import. This makes it safe to import any
1889 file/message content whose lines might start with <code>#</code>.</p></div>
1890 <div class="dlist"><dl>
1891 <dt class="hdlist1">
1892 Exact byte count format
1893 </dt>
1894 <dd>
1896 The frontend must specify the number of bytes of data.
1897 </p>
1898 <div class="literalblock">
1899 <div class="content">
1900 <pre><code> 'data' SP &lt;count&gt; LF
1901 &lt;raw&gt; LF?</code></pre>
1902 </div></div>
1903 <div class="paragraph"><p>where <code>&lt;count&gt;</code> is the exact number of bytes appearing within
1904 <code>&lt;raw&gt;</code>. The value of <code>&lt;count&gt;</code> is expressed as an ASCII decimal
1905 integer. The <code>LF</code> on either side of <code>&lt;raw&gt;</code> is not
1906 included in <code>&lt;count&gt;</code> and will not be included in the imported data.</p></div>
1907 <div class="paragraph"><p>The <code>LF</code> after <code>&lt;raw&gt;</code> is optional (it used to be required) but
1908 recommended. Always including it makes debugging a fast-import
1909 stream easier as the next command always starts in column 0
1910 of the next line, even if <code>&lt;raw&gt;</code> did not end with an <code>LF</code>.</p></div>
1911 </dd>
1912 <dt class="hdlist1">
1913 Delimited format
1914 </dt>
1915 <dd>
1917 A delimiter string is used to mark the end of the data.
1918 fast-import will compute the length by searching for the delimiter.
1919 This format is primarily useful for testing and is not
1920 recommended for real data.
1921 </p>
1922 <div class="literalblock">
1923 <div class="content">
1924 <pre><code> 'data' SP '&lt;&lt;' &lt;delim&gt; LF
1925 &lt;raw&gt; LF
1926 &lt;delim&gt; LF
1927 LF?</code></pre>
1928 </div></div>
1929 <div class="paragraph"><p>where <code>&lt;delim&gt;</code> is the chosen delimiter string. The string <code>&lt;delim&gt;</code>
1930 must not appear on a line by itself within <code>&lt;raw&gt;</code>, as otherwise
1931 fast-import will think the data ends earlier than it really does. The <code>LF</code>
1932 immediately trailing <code>&lt;raw&gt;</code> is part of <code>&lt;raw&gt;</code>. This is one of
1933 the limitations of the delimited format, it is impossible to supply
1934 a data chunk which does not have an LF as its last byte.</p></div>
1935 <div class="paragraph"><p>The <code>LF</code> after <code>&lt;delim&gt; LF</code> is optional (it used to be required).</p></div>
1936 </dd>
1937 </dl></div>
1938 </div>
1939 <div class="sect2">
1940 <h3 id="_code_alias_code"><code>alias</code></h3>
1941 <div class="paragraph"><p>Record that a mark refers to a given object without first creating any
1942 new object.</p></div>
1943 <div class="literalblock">
1944 <div class="content">
1945 <pre><code> 'alias' LF
1946 mark
1947 'to' SP &lt;commit-ish&gt; LF
1948 LF?</code></pre>
1949 </div></div>
1950 <div class="paragraph"><p>For a detailed description of <code>&lt;commit-ish&gt;</code> see above under <code>from</code>.</p></div>
1951 </div>
1952 <div class="sect2">
1953 <h3 id="_code_checkpoint_code"><code>checkpoint</code></h3>
1954 <div class="paragraph"><p>Forces fast-import to close the current packfile, start a new one, and to
1955 save out all current branch refs, tags and marks.</p></div>
1956 <div class="literalblock">
1957 <div class="content">
1958 <pre><code> 'checkpoint' LF
1959 LF?</code></pre>
1960 </div></div>
1961 <div class="paragraph"><p>Note that fast-import automatically switches packfiles when the current
1962 packfile reaches --max-pack-size, or 4 GiB, whichever limit is
1963 smaller. During an automatic packfile switch fast-import does not update
1964 the branch refs, tags or marks.</p></div>
1965 <div class="paragraph"><p>As a <code>checkpoint</code> can require a significant amount of CPU time and
1966 disk IO (to compute the overall pack SHA-1 checksum, generate the
1967 corresponding index file, and update the refs) it can easily take
1968 several minutes for a single <code>checkpoint</code> command to complete.</p></div>
1969 <div class="paragraph"><p>Frontends may choose to issue checkpoints during extremely large
1970 and long running imports, or when they need to allow another Git
1971 process access to a branch. However given that a 30 GiB Subversion
1972 repository can be loaded into Git through fast-import in about 3 hours,
1973 explicit checkpointing may not be necessary.</p></div>
1974 <div class="paragraph"><p>The <code>LF</code> after the command is optional (it used to be required).</p></div>
1975 </div>
1976 <div class="sect2">
1977 <h3 id="_code_progress_code"><code>progress</code></h3>
1978 <div class="paragraph"><p>Causes fast-import to print the entire <code>progress</code> line unmodified to
1979 its standard output channel (file descriptor 1) when the command is
1980 processed from the input stream. The command otherwise has no impact
1981 on the current import, or on any of fast-import&#8217;s internal state.</p></div>
1982 <div class="literalblock">
1983 <div class="content">
1984 <pre><code> 'progress' SP &lt;any&gt; LF
1985 LF?</code></pre>
1986 </div></div>
1987 <div class="paragraph"><p>The <code>&lt;any&gt;</code> part of the command may contain any sequence of bytes
1988 that does not contain <code>LF</code>. The <code>LF</code> after the command is optional.
1989 Callers may wish to process the output through a tool such as sed to
1990 remove the leading part of the line, for example:</p></div>
1991 <div class="exampleblock">
1992 <div class="content">
1993 <div class="literalblock">
1994 <div class="content">
1995 <pre><code>frontend | git fast-import | sed 's/^progress //'</code></pre>
1996 </div></div>
1997 </div></div>
1998 <div class="paragraph"><p>Placing a <code>progress</code> command immediately after a <code>checkpoint</code> will
1999 inform the reader when the <code>checkpoint</code> has been completed and it
2000 can safely access the refs that fast-import updated.</p></div>
2001 </div>
2002 <div class="sect2">
2003 <h3 id="_code_get_mark_code"><code>get-mark</code></h3>
2004 <div class="paragraph"><p>Causes fast-import to print the SHA-1 corresponding to a mark to
2005 stdout or to the file descriptor previously arranged with the
2006 <code>--cat-blob-fd</code> argument. The command otherwise has no impact on the
2007 current import; its purpose is to retrieve SHA-1s that later commits
2008 might want to refer to in their commit messages.</p></div>
2009 <div class="literalblock">
2010 <div class="content">
2011 <pre><code> 'get-mark' SP ':' &lt;idnum&gt; LF</code></pre>
2012 </div></div>
2013 <div class="paragraph"><p>See &#8220;Responses To Commands&#8221; below for details about how to read
2014 this output safely.</p></div>
2015 </div>
2016 <div class="sect2">
2017 <h3 id="_code_cat_blob_code"><code>cat-blob</code></h3>
2018 <div class="paragraph"><p>Causes fast-import to print a blob to a file descriptor previously
2019 arranged with the <code>--cat-blob-fd</code> argument. The command otherwise
2020 has no impact on the current import; its main purpose is to
2021 retrieve blobs that may be in fast-import&#8217;s memory but not
2022 accessible from the target repository.</p></div>
2023 <div class="literalblock">
2024 <div class="content">
2025 <pre><code> 'cat-blob' SP &lt;dataref&gt; LF</code></pre>
2026 </div></div>
2027 <div class="paragraph"><p>The <code>&lt;dataref&gt;</code> can be either a mark reference (<code>:&lt;idnum&gt;</code>)
2028 set previously or a full 40-byte SHA-1 of a Git blob, preexisting or
2029 ready to be written.</p></div>
2030 <div class="paragraph"><p>Output uses the same format as <code>git cat-file --batch</code>:</p></div>
2031 <div class="exampleblock">
2032 <div class="content">
2033 <div class="literalblock">
2034 <div class="content">
2035 <pre><code>&lt;sha1&gt; SP 'blob' SP &lt;size&gt; LF
2036 &lt;contents&gt; LF</code></pre>
2037 </div></div>
2038 </div></div>
2039 <div class="paragraph"><p>This command can be used where a <code>filemodify</code> directive can appear,
2040 allowing it to be used in the middle of a commit. For a <code>filemodify</code>
2041 using an inline directive, it can also appear right before the <code>data</code>
2042 directive.</p></div>
2043 <div class="paragraph"><p>See &#8220;Responses To Commands&#8221; below for details about how to read
2044 this output safely.</p></div>
2045 </div>
2046 <div class="sect2">
2047 <h3 id="_code_ls_code"><code>ls</code></h3>
2048 <div class="paragraph"><p>Prints information about the object at a path to a file descriptor
2049 previously arranged with the <code>--cat-blob-fd</code> argument. This allows
2050 printing a blob from the active commit (with <code>cat-blob</code>) or copying a
2051 blob or tree from a previous commit for use in the current one (with
2052 <code>filemodify</code>).</p></div>
2053 <div class="paragraph"><p>The <code>ls</code> command can also be used where a <code>filemodify</code> directive can
2054 appear, allowing it to be used in the middle of a commit.</p></div>
2055 <div class="dlist"><dl>
2056 <dt class="hdlist1">
2057 Reading from the active commit
2058 </dt>
2059 <dd>
2061 This form can only be used in the middle of a <code>commit</code>.
2062 The path names a directory entry within fast-import&#8217;s
2063 active commit. The path must be quoted in this case.
2064 </p>
2065 <div class="literalblock">
2066 <div class="content">
2067 <pre><code> 'ls' SP &lt;path&gt; LF</code></pre>
2068 </div></div>
2069 </dd>
2070 <dt class="hdlist1">
2071 Reading from a named tree
2072 </dt>
2073 <dd>
2075 The <code>&lt;dataref&gt;</code> can be a mark reference (<code>:&lt;idnum&gt;</code>) or the
2076 full 40-byte SHA-1 of a Git tag, commit, or tree object,
2077 preexisting or waiting to be written.
2078 The path is relative to the top level of the tree
2079 named by <code>&lt;dataref&gt;</code>.
2080 </p>
2081 <div class="literalblock">
2082 <div class="content">
2083 <pre><code> 'ls' SP &lt;dataref&gt; SP &lt;path&gt; LF</code></pre>
2084 </div></div>
2085 </dd>
2086 </dl></div>
2087 <div class="paragraph"><p>See <code>filemodify</code> above for a detailed description of <code>&lt;path&gt;</code>.</p></div>
2088 <div class="paragraph"><p>Output uses the same format as <code>git ls-tree &lt;tree&gt; -- &lt;path&gt;</code>:</p></div>
2089 <div class="exampleblock">
2090 <div class="content">
2091 <div class="literalblock">
2092 <div class="content">
2093 <pre><code>&lt;mode&gt; SP ('blob' | 'tree' | 'commit') SP &lt;dataref&gt; HT &lt;path&gt; LF</code></pre>
2094 </div></div>
2095 </div></div>
2096 <div class="paragraph"><p>The &lt;dataref&gt; represents the blob, tree, or commit object at &lt;path&gt;
2097 and can be used in later <em>get-mark</em>, <em>cat-blob</em>, <em>filemodify</em>, or
2098 <em>ls</em> commands.</p></div>
2099 <div class="paragraph"><p>If there is no file or subtree at that path, <em>git fast-import</em> will
2100 instead report</p></div>
2101 <div class="exampleblock">
2102 <div class="content">
2103 <div class="literalblock">
2104 <div class="content">
2105 <pre><code>missing SP &lt;path&gt; LF</code></pre>
2106 </div></div>
2107 </div></div>
2108 <div class="paragraph"><p>See &#8220;Responses To Commands&#8221; below for details about how to read
2109 this output safely.</p></div>
2110 </div>
2111 <div class="sect2">
2112 <h3 id="_code_feature_code"><code>feature</code></h3>
2113 <div class="paragraph"><p>Require that fast-import supports the specified feature, or abort if
2114 it does not.</p></div>
2115 <div class="literalblock">
2116 <div class="content">
2117 <pre><code> 'feature' SP &lt;feature&gt; ('=' &lt;argument&gt;)? LF</code></pre>
2118 </div></div>
2119 <div class="paragraph"><p>The &lt;feature&gt; part of the command may be any one of the following:</p></div>
2120 <div class="dlist"><dl>
2121 <dt class="hdlist1">
2122 date-format
2123 </dt>
2124 <dt class="hdlist1">
2125 export-marks
2126 </dt>
2127 <dt class="hdlist1">
2128 relative-marks
2129 </dt>
2130 <dt class="hdlist1">
2131 no-relative-marks
2132 </dt>
2133 <dt class="hdlist1">
2134 force
2135 </dt>
2136 <dd>
2138 Act as though the corresponding command-line option with
2139 a leading <code>--</code> was passed on the command line
2140 (see OPTIONS, above).
2141 </p>
2142 </dd>
2143 <dt class="hdlist1">
2144 import-marks
2145 </dt>
2146 <dt class="hdlist1">
2147 import-marks-if-exists
2148 </dt>
2149 <dd>
2151 Like --import-marks except in two respects: first, only one
2152 "feature import-marks" or "feature import-marks-if-exists"
2153 command is allowed per stream; second, an --import-marks=
2154 or --import-marks-if-exists command-line option overrides
2155 any of these "feature" commands in the stream; third,
2156 "feature import-marks-if-exists" like a corresponding
2157 command-line option silently skips a nonexistent file.
2158 </p>
2159 </dd>
2160 <dt class="hdlist1">
2161 get-mark
2162 </dt>
2163 <dt class="hdlist1">
2164 cat-blob
2165 </dt>
2166 <dt class="hdlist1">
2168 </dt>
2169 <dd>
2171 Require that the backend support the <em>get-mark</em>, <em>cat-blob</em>,
2172 or <em>ls</em> command respectively.
2173 Versions of fast-import not supporting the specified command
2174 will exit with a message indicating so.
2175 This lets the import error out early with a clear message,
2176 rather than wasting time on the early part of an import
2177 before the unsupported command is detected.
2178 </p>
2179 </dd>
2180 <dt class="hdlist1">
2181 notes
2182 </dt>
2183 <dd>
2185 Require that the backend support the <em>notemodify</em> (N)
2186 subcommand to the <em>commit</em> command.
2187 Versions of fast-import not supporting notes will exit
2188 with a message indicating so.
2189 </p>
2190 </dd>
2191 <dt class="hdlist1">
2192 done
2193 </dt>
2194 <dd>
2196 Error out if the stream ends without a <em>done</em> command.
2197 Without this feature, errors causing the frontend to end
2198 abruptly at a convenient point in the stream can go
2199 undetected. This may occur, for example, if an import
2200 front end dies in mid-operation without emitting SIGTERM
2201 or SIGKILL at its subordinate git fast-import instance.
2202 </p>
2203 </dd>
2204 </dl></div>
2205 </div>
2206 <div class="sect2">
2207 <h3 id="_code_option_code"><code>option</code></h3>
2208 <div class="paragraph"><p>Processes the specified option so that git fast-import behaves in a
2209 way that suits the frontend&#8217;s needs.
2210 Note that options specified by the frontend are overridden by any
2211 options the user may specify to git fast-import itself.</p></div>
2212 <div class="literalblock">
2213 <div class="content">
2214 <pre><code> 'option' SP &lt;option&gt; LF</code></pre>
2215 </div></div>
2216 <div class="paragraph"><p>The <code>&lt;option&gt;</code> part of the command may contain any of the options
2217 listed in the OPTIONS section that do not change import semantics,
2218 without the leading <code>--</code> and is treated in the same way.</p></div>
2219 <div class="paragraph"><p>Option commands must be the first commands on the input (not counting
2220 feature commands), to give an option command after any non-option
2221 command is an error.</p></div>
2222 <div class="paragraph"><p>The following command-line options change import semantics and may therefore
2223 not be passed as option:</p></div>
2224 <div class="ulist"><ul>
2225 <li>
2227 date-format
2228 </p>
2229 </li>
2230 <li>
2232 import-marks
2233 </p>
2234 </li>
2235 <li>
2237 export-marks
2238 </p>
2239 </li>
2240 <li>
2242 cat-blob-fd
2243 </p>
2244 </li>
2245 <li>
2247 force
2248 </p>
2249 </li>
2250 </ul></div>
2251 </div>
2252 <div class="sect2">
2253 <h3 id="_code_done_code"><code>done</code></h3>
2254 <div class="paragraph"><p>If the <code>done</code> feature is not in use, treated as if EOF was read.
2255 This can be used to tell fast-import to finish early.</p></div>
2256 <div class="paragraph"><p>If the <code>--done</code> command-line option or <code>feature done</code> command is
2257 in use, the <code>done</code> command is mandatory and marks the end of the
2258 stream.</p></div>
2259 </div>
2260 </div>
2261 </div>
2262 <div class="sect1">
2263 <h2 id="_responses_to_commands">RESPONSES TO COMMANDS</h2>
2264 <div class="sectionbody">
2265 <div class="paragraph"><p>New objects written by fast-import are not available immediately.
2266 Most fast-import commands have no visible effect until the next
2267 checkpoint (or completion). The frontend can send commands to
2268 fill fast-import&#8217;s input pipe without worrying about how quickly
2269 they will take effect, which improves performance by simplifying
2270 scheduling.</p></div>
2271 <div class="paragraph"><p>For some frontends, though, it is useful to be able to read back
2272 data from the current repository as it is being updated (for
2273 example when the source material describes objects in terms of
2274 patches to be applied to previously imported objects). This can
2275 be accomplished by connecting the frontend and fast-import via
2276 bidirectional pipes:</p></div>
2277 <div class="exampleblock">
2278 <div class="content">
2279 <div class="literalblock">
2280 <div class="content">
2281 <pre><code>mkfifo fast-import-output
2282 frontend &lt;fast-import-output |
2283 git fast-import &gt;fast-import-output</code></pre>
2284 </div></div>
2285 </div></div>
2286 <div class="paragraph"><p>A frontend set up this way can use <code>progress</code>, <code>get-mark</code>, <code>ls</code>, and
2287 <code>cat-blob</code> commands to read information from the import in progress.</p></div>
2288 <div class="paragraph"><p>To avoid deadlock, such frontends must completely consume any
2289 pending output from <code>progress</code>, <code>ls</code>, <code>get-mark</code>, and <code>cat-blob</code> before
2290 performing writes to fast-import that might block.</p></div>
2291 </div>
2292 </div>
2293 <div class="sect1">
2294 <h2 id="_crash_reports">CRASH REPORTS</h2>
2295 <div class="sectionbody">
2296 <div class="paragraph"><p>If fast-import is supplied invalid input it will terminate with a
2297 non-zero exit status and create a crash report in the top level of
2298 the Git repository it was importing into. Crash reports contain
2299 a snapshot of the internal fast-import state as well as the most
2300 recent commands that lead up to the crash.</p></div>
2301 <div class="paragraph"><p>All recent commands (including stream comments, file changes and
2302 progress commands) are shown in the command history within the crash
2303 report, but raw file data and commit messages are excluded from the
2304 crash report. This exclusion saves space within the report file
2305 and reduces the amount of buffering that fast-import must perform
2306 during execution.</p></div>
2307 <div class="paragraph"><p>After writing a crash report fast-import will close the current
2308 packfile and export the marks table. This allows the frontend
2309 developer to inspect the repository state and resume the import from
2310 the point where it crashed. The modified branches and tags are not
2311 updated during a crash, as the import did not complete successfully.
2312 Branch and tag information can be found in the crash report and
2313 must be applied manually if the update is needed.</p></div>
2314 <div class="paragraph"><p>An example crash:</p></div>
2315 <div class="exampleblock">
2316 <div class="content">
2317 <div class="literalblock">
2318 <div class="content">
2319 <pre><code>$ cat &gt;in &lt;&lt;END_OF_INPUT
2320 # my very first test commit
2321 commit refs/heads/master
2322 committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400
2323 # who is that guy anyway?
2324 data &lt;&lt;EOF
2325 this is my commit
2327 M 644 inline .gitignore
2328 data &lt;&lt;EOF
2329 .gitignore
2331 M 777 inline bob
2332 END_OF_INPUT</code></pre>
2333 </div></div>
2334 <div class="literalblock">
2335 <div class="content">
2336 <pre><code>$ git fast-import &lt;in
2337 fatal: Corrupt mode: M 777 inline bob
2338 fast-import: dumping crash report to .git/fast_import_crash_8434</code></pre>
2339 </div></div>
2340 <div class="literalblock">
2341 <div class="content">
2342 <pre><code>$ cat .git/fast_import_crash_8434
2343 fast-import crash report:
2344 fast-import process: 8434
2345 parent process : 1391
2346 at Sat Sep 1 00:58:12 2007</code></pre>
2347 </div></div>
2348 <div class="literalblock">
2349 <div class="content">
2350 <pre><code>fatal: Corrupt mode: M 777 inline bob</code></pre>
2351 </div></div>
2352 <div class="literalblock">
2353 <div class="content">
2354 <pre><code>Most Recent Commands Before Crash
2355 ---------------------------------
2356 # my very first test commit
2357 commit refs/heads/master
2358 committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400
2359 # who is that guy anyway?
2360 data &lt;&lt;EOF
2361 M 644 inline .gitignore
2362 data &lt;&lt;EOF
2363 * M 777 inline bob</code></pre>
2364 </div></div>
2365 <div class="literalblock">
2366 <div class="content">
2367 <pre><code>Active Branch LRU
2368 -----------------
2369 active_branches = 1 cur, 5 max</code></pre>
2370 </div></div>
2371 <div class="literalblock">
2372 <div class="content">
2373 <pre><code>pos clock name
2374 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2375 1) 0 refs/heads/master</code></pre>
2376 </div></div>
2377 <div class="literalblock">
2378 <div class="content">
2379 <pre><code>Inactive Branches
2380 -----------------
2381 refs/heads/master:
2382 status : active loaded dirty
2383 tip commit : 0000000000000000000000000000000000000000
2384 old tree : 0000000000000000000000000000000000000000
2385 cur tree : 0000000000000000000000000000000000000000
2386 commit clock: 0
2387 last pack :</code></pre>
2388 </div></div>
2389 <div class="literalblock">
2390 <div class="content">
2391 <pre><code>-------------------
2392 END OF CRASH REPORT</code></pre>
2393 </div></div>
2394 </div></div>
2395 </div>
2396 </div>
2397 <div class="sect1">
2398 <h2 id="_tips_and_tricks">TIPS AND TRICKS</h2>
2399 <div class="sectionbody">
2400 <div class="paragraph"><p>The following tips and tricks have been collected from various
2401 users of fast-import, and are offered here as suggestions.</p></div>
2402 <div class="sect2">
2403 <h3 id="_use_one_mark_per_commit">Use One Mark Per Commit</h3>
2404 <div class="paragraph"><p>When doing a repository conversion, use a unique mark per commit
2405 (<code>mark :&lt;n&gt;</code>) and supply the --export-marks option on the command
2406 line. fast-import will dump a file which lists every mark and the Git
2407 object SHA-1 that corresponds to it. If the frontend can tie
2408 the marks back to the source repository, it is easy to verify the
2409 accuracy and completeness of the import by comparing each Git
2410 commit to the corresponding source revision.</p></div>
2411 <div class="paragraph"><p>Coming from a system such as Perforce or Subversion, this should be
2412 quite simple, as the fast-import mark can also be the Perforce changeset
2413 number or the Subversion revision number.</p></div>
2414 </div>
2415 <div class="sect2">
2416 <h3 id="_freely_skip_around_branches">Freely Skip Around Branches</h3>
2417 <div class="paragraph"><p>Don&#8217;t bother trying to optimize the frontend to stick to one branch
2418 at a time during an import. Although doing so might be slightly
2419 faster for fast-import, it tends to increase the complexity of the frontend
2420 code considerably.</p></div>
2421 <div class="paragraph"><p>The branch LRU builtin to fast-import tends to behave very well, and the
2422 cost of activating an inactive branch is so low that bouncing around
2423 between branches has virtually no impact on import performance.</p></div>
2424 </div>
2425 <div class="sect2">
2426 <h3 id="_handling_renames">Handling Renames</h3>
2427 <div class="paragraph"><p>When importing a renamed file or directory, simply delete the old
2428 name(s) and modify the new name(s) during the corresponding commit.
2429 Git performs rename detection after-the-fact, rather than explicitly
2430 during a commit.</p></div>
2431 </div>
2432 <div class="sect2">
2433 <h3 id="_use_tag_fixup_branches">Use Tag Fixup Branches</h3>
2434 <div class="paragraph"><p>Some other SCM systems let the user create a tag from multiple
2435 files which are not from the same commit/changeset. Or to create
2436 tags which are a subset of the files available in the repository.</p></div>
2437 <div class="paragraph"><p>Importing these tags as-is in Git is impossible without making at
2438 least one commit which &#8220;fixes up&#8221; the files to match the content
2439 of the tag. Use fast-import&#8217;s <code>reset</code> command to reset a dummy branch
2440 outside of your normal branch space to the base commit for the tag,
2441 then commit one or more file fixup commits, and finally tag the
2442 dummy branch.</p></div>
2443 <div class="paragraph"><p>For example since all normal branches are stored under <code>refs/heads/</code>
2444 name the tag fixup branch <code>TAG_FIXUP</code>. This way it is impossible for
2445 the fixup branch used by the importer to have namespace conflicts
2446 with real branches imported from the source (the name <code>TAG_FIXUP</code>
2447 is not <code>refs/heads/TAG_FIXUP</code>).</p></div>
2448 <div class="paragraph"><p>When committing fixups, consider using <code>merge</code> to connect the
2449 commit(s) which are supplying file revisions to the fixup branch.
2450 Doing so will allow tools such as <em>git blame</em> to track
2451 through the real commit history and properly annotate the source
2452 files.</p></div>
2453 <div class="paragraph"><p>After fast-import terminates the frontend will need to do <code>rm .git/TAG_FIXUP</code>
2454 to remove the dummy branch.</p></div>
2455 </div>
2456 <div class="sect2">
2457 <h3 id="_import_now_repack_later">Import Now, Repack Later</h3>
2458 <div class="paragraph"><p>As soon as fast-import completes the Git repository is completely valid
2459 and ready for use. Typically this takes only a very short time,
2460 even for considerably large projects (100,000+ commits).</p></div>
2461 <div class="paragraph"><p>However repacking the repository is necessary to improve data
2462 locality and access performance. It can also take hours on extremely
2463 large projects (especially if -f and a large --window parameter is
2464 used). Since repacking is safe to run alongside readers and writers,
2465 run the repack in the background and let it finish when it finishes.
2466 There is no reason to wait to explore your new Git project!</p></div>
2467 <div class="paragraph"><p>If you choose to wait for the repack, don&#8217;t try to run benchmarks
2468 or performance tests until repacking is completed. fast-import outputs
2469 suboptimal packfiles that are simply never seen in real use
2470 situations.</p></div>
2471 </div>
2472 <div class="sect2">
2473 <h3 id="_repacking_historical_data">Repacking Historical Data</h3>
2474 <div class="paragraph"><p>If you are repacking very old imported data (e.g. older than the
2475 last year), consider expending some extra CPU time and supplying
2476 --window=50 (or higher) when you run <em>git repack</em>.
2477 This will take longer, but will also produce a smaller packfile.
2478 You only need to expend the effort once, and everyone using your
2479 project will benefit from the smaller repository.</p></div>
2480 </div>
2481 <div class="sect2">
2482 <h3 id="_include_some_progress_messages">Include Some Progress Messages</h3>
2483 <div class="paragraph"><p>Every once in a while have your frontend emit a <code>progress</code> message
2484 to fast-import. The contents of the messages are entirely free-form,
2485 so one suggestion would be to output the current month and year
2486 each time the current commit date moves into the next month.
2487 Your users will feel better knowing how much of the data stream
2488 has been processed.</p></div>
2489 </div>
2490 </div>
2491 </div>
2492 <div class="sect1">
2493 <h2 id="_packfile_optimization">PACKFILE OPTIMIZATION</h2>
2494 <div class="sectionbody">
2495 <div class="paragraph"><p>When packing a blob fast-import always attempts to deltify against the last
2496 blob written. Unless specifically arranged for by the frontend,
2497 this will probably not be a prior version of the same file, so the
2498 generated delta will not be the smallest possible. The resulting
2499 packfile will be compressed, but will not be optimal.</p></div>
2500 <div class="paragraph"><p>Frontends which have efficient access to all revisions of a
2501 single file (for example reading an RCS/CVS ,v file) can choose
2502 to supply all revisions of that file as a sequence of consecutive
2503 <code>blob</code> commands. This allows fast-import to deltify the different file
2504 revisions against each other, saving space in the final packfile.
2505 Marks can be used to later identify individual file revisions during
2506 a sequence of <code>commit</code> commands.</p></div>
2507 <div class="paragraph"><p>The packfile(s) created by fast-import do not encourage good disk access
2508 patterns. This is caused by fast-import writing the data in the order
2509 it is received on standard input, while Git typically organizes
2510 data within packfiles to make the most recent (current tip) data
2511 appear before historical data. Git also clusters commits together,
2512 speeding up revision traversal through better cache locality.</p></div>
2513 <div class="paragraph"><p>For this reason it is strongly recommended that users repack the
2514 repository with <code>git repack -a -d</code> after fast-import completes, allowing
2515 Git to reorganize the packfiles for faster data access. If blob
2516 deltas are suboptimal (see above) then also adding the <code>-f</code> option
2517 to force recomputation of all deltas can significantly reduce the
2518 final packfile size (30-50% smaller can be quite typical).</p></div>
2519 <div class="paragraph"><p>Instead of running <code>git repack</code> you can also run <code>git gc
2520 --aggressive</code>, which will also optimize other things after an import
2521 (e.g. pack loose refs). As noted in the "AGGRESSIVE" section in
2522 <a href="git-gc.html">git-gc(1)</a> the <code>--aggressive</code> option will find new deltas with
2523 the <code>-f</code> option to <a href="git-repack.html">git-repack(1)</a>. For the reasons elaborated
2524 on above using <code>--aggressive</code> after a fast-import is one of the few
2525 cases where it&#8217;s known to be worthwhile.</p></div>
2526 </div>
2527 </div>
2528 <div class="sect1">
2529 <h2 id="_memory_utilization">MEMORY UTILIZATION</h2>
2530 <div class="sectionbody">
2531 <div class="paragraph"><p>There are a number of factors which affect how much memory fast-import
2532 requires to perform an import. Like critical sections of core
2533 Git, fast-import uses its own memory allocators to amortize any overheads
2534 associated with malloc. In practice fast-import tends to amortize any
2535 malloc overheads to 0, due to its use of large block allocations.</p></div>
2536 <div class="sect2">
2537 <h3 id="_per_object">per object</h3>
2538 <div class="paragraph"><p>fast-import maintains an in-memory structure for every object written in
2539 this execution. On a 32 bit system the structure is 32 bytes,
2540 on a 64 bit system the structure is 40 bytes (due to the larger
2541 pointer sizes). Objects in the table are not deallocated until
2542 fast-import terminates. Importing 2 million objects on a 32 bit system
2543 will require approximately 64 MiB of memory.</p></div>
2544 <div class="paragraph"><p>The object table is actually a hashtable keyed on the object name
2545 (the unique SHA-1). This storage configuration allows fast-import to reuse
2546 an existing or already written object and avoid writing duplicates
2547 to the output packfile. Duplicate blobs are surprisingly common
2548 in an import, typically due to branch merges in the source.</p></div>
2549 </div>
2550 <div class="sect2">
2551 <h3 id="_per_mark">per mark</h3>
2552 <div class="paragraph"><p>Marks are stored in a sparse array, using 1 pointer (4 bytes or 8
2553 bytes, depending on pointer size) per mark. Although the array
2554 is sparse, frontends are still strongly encouraged to use marks
2555 between 1 and n, where n is the total number of marks required for
2556 this import.</p></div>
2557 </div>
2558 <div class="sect2">
2559 <h3 id="_per_branch">per branch</h3>
2560 <div class="paragraph"><p>Branches are classified as active and inactive. The memory usage
2561 of the two classes is significantly different.</p></div>
2562 <div class="paragraph"><p>Inactive branches are stored in a structure which uses 96 or 120
2563 bytes (32 bit or 64 bit systems, respectively), plus the length of
2564 the branch name (typically under 200 bytes), per branch. fast-import will
2565 easily handle as many as 10,000 inactive branches in under 2 MiB
2566 of memory.</p></div>
2567 <div class="paragraph"><p>Active branches have the same overhead as inactive branches, but
2568 also contain copies of every tree that has been recently modified on
2569 that branch. If subtree <code>include</code> has not been modified since the
2570 branch became active, its contents will not be loaded into memory,
2571 but if subtree <code>src</code> has been modified by a commit since the branch
2572 became active, then its contents will be loaded in memory.</p></div>
2573 <div class="paragraph"><p>As active branches store metadata about the files contained on that
2574 branch, their in-memory storage size can grow to a considerable size
2575 (see below).</p></div>
2576 <div class="paragraph"><p>fast-import automatically moves active branches to inactive status based on
2577 a simple least-recently-used algorithm. The LRU chain is updated on
2578 each <code>commit</code> command. The maximum number of active branches can be
2579 increased or decreased on the command line with --active-branches=.</p></div>
2580 </div>
2581 <div class="sect2">
2582 <h3 id="_per_active_tree">per active tree</h3>
2583 <div class="paragraph"><p>Trees (aka directories) use just 12 bytes of memory on top of the
2584 memory required for their entries (see &#8220;per active file&#8221; below).
2585 The cost of a tree is virtually 0, as its overhead amortizes out
2586 over the individual file entries.</p></div>
2587 </div>
2588 <div class="sect2">
2589 <h3 id="_per_active_file_entry">per active file entry</h3>
2590 <div class="paragraph"><p>Files (and pointers to subtrees) within active trees require 52 or 64
2591 bytes (32/64 bit platforms) per entry. To conserve space, file and
2592 tree names are pooled in a common string table, allowing the filename
2593 &#8220;Makefile&#8221; to use just 16 bytes (after including the string header
2594 overhead) no matter how many times it occurs within the project.</p></div>
2595 <div class="paragraph"><p>The active branch LRU, when coupled with the filename string pool
2596 and lazy loading of subtrees, allows fast-import to efficiently import
2597 projects with 2,000+ branches and 45,114+ files in a very limited
2598 memory footprint (less than 2.7 MiB per active branch).</p></div>
2599 </div>
2600 </div>
2601 </div>
2602 <div class="sect1">
2603 <h2 id="_signals">SIGNALS</h2>
2604 <div class="sectionbody">
2605 <div class="paragraph"><p>Sending <strong>SIGUSR1</strong> to the <em>git fast-import</em> process ends the current
2606 packfile early, simulating a <code>checkpoint</code> command. The impatient
2607 operator can use this facility to peek at the objects and refs from an
2608 import in progress, at the cost of some added running time and worse
2609 compression.</p></div>
2610 </div>
2611 </div>
2612 <div class="sect1">
2613 <h2 id="_configuration">CONFIGURATION</h2>
2614 <div class="sectionbody">
2615 <div class="paragraph"><p>Everything below this line in this section is selectively included
2616 from the <a href="git-config.html">git-config(1)</a> documentation. The content is the same
2617 as what&#8217;s found there:</p></div>
2618 <div class="dlist"><dl>
2619 <dt class="hdlist1">
2620 fastimport.unpackLimit
2621 </dt>
2622 <dd>
2624 If the number of objects imported by <a href="git-fast-import.html">git-fast-import(1)</a>
2625 is below this limit, then the objects will be unpacked into
2626 loose object files. However, if the number of imported objects
2627 equals or exceeds this limit, then the pack will be stored as a
2628 pack. Storing the pack from a fast-import can make the import
2629 operation complete faster, especially on slow filesystems. If
2630 not set, the value of <code>transfer.unpackLimit</code> is used instead.
2631 </p>
2632 </dd>
2633 </dl></div>
2634 </div>
2635 </div>
2636 <div class="sect1">
2637 <h2 id="_see_also">SEE ALSO</h2>
2638 <div class="sectionbody">
2639 <div class="paragraph"><p><a href="git-fast-export.html">git-fast-export(1)</a></p></div>
2640 </div>
2641 </div>
2642 <div class="sect1">
2643 <h2 id="_git">GIT</h2>
2644 <div class="sectionbody">
2645 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
2646 </div>
2647 </div>
2648 </div>
2649 <div id="footnotes"><hr /></div>
2650 <div id="footer">
2651 <div id="footer-text">
2652 Last updated
2653 2024-04-23 14:40:04 PDT
2654 </div>
2655 </div>
2656 </body>
2657 </html>