Autogenerated HTML docs for v2.44.0-rc0-46-g2996f
[git-htmldocs.git] / git-fast-import.html
blob4d7aaaf05cfd84160297a5212cbef66e43b6b15c
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 email 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> string must use UNIX-style directory separators (forward
1587 slash <code>/</code>), may contain any byte other than <code>LF</code>, and must not
1588 start with double quote (<code>"</code>).</p></div>
1589 <div class="paragraph"><p>A path can use C-style string quoting; this is accepted in all cases
1590 and mandatory if the filename starts with double quote or contains
1591 <code>LF</code>. In C-style quoting, the complete name should be surrounded with
1592 double quotes, and any <code>LF</code>, backslash, or double quote characters
1593 must be escaped by preceding them with a backslash (e.g.,
1594 <code>"path/with\n, \\ and \" in it"</code>).</p></div>
1595 <div class="paragraph"><p>The value of <code>&lt;path&gt;</code> must be in canonical form. That is it must not:</p></div>
1596 <div class="ulist"><ul>
1597 <li>
1599 contain an empty directory component (e.g. <code>foo//bar</code> is invalid),
1600 </p>
1601 </li>
1602 <li>
1604 end with a directory separator (e.g. <code>foo/</code> is invalid),
1605 </p>
1606 </li>
1607 <li>
1609 start with a directory separator (e.g. <code>/foo</code> is invalid),
1610 </p>
1611 </li>
1612 <li>
1614 contain the special component <code>.</code> or <code>..</code> (e.g. <code>foo/./bar</code> and
1615 <code>foo/../bar</code> are invalid).
1616 </p>
1617 </li>
1618 </ul></div>
1619 <div class="paragraph"><p>The root of the tree can be represented by an empty string as <code>&lt;path&gt;</code>.</p></div>
1620 <div class="paragraph"><p>It is recommended that <code>&lt;path&gt;</code> always be encoded using UTF-8.</p></div>
1621 </div>
1622 <div class="sect3">
1623 <h4 id="_code_filedelete_code"><code>filedelete</code></h4>
1624 <div class="paragraph"><p>Included in a <code>commit</code> command to remove a file or recursively
1625 delete an entire directory from the branch. If the file or directory
1626 removal makes its parent directory empty, the parent directory will
1627 be automatically removed too. This cascades up the tree until the
1628 first non-empty directory or the root is reached.</p></div>
1629 <div class="literalblock">
1630 <div class="content">
1631 <pre><code> 'D' SP &lt;path&gt; LF</code></pre>
1632 </div></div>
1633 <div class="paragraph"><p>here <code>&lt;path&gt;</code> is the complete path of the file or subdirectory to
1634 be removed from the branch.
1635 See <code>filemodify</code> above for a detailed description of <code>&lt;path&gt;</code>.</p></div>
1636 </div>
1637 <div class="sect3">
1638 <h4 id="_code_filecopy_code"><code>filecopy</code></h4>
1639 <div class="paragraph"><p>Recursively copies an existing file or subdirectory to a different
1640 location within the branch. The existing file or directory must
1641 exist. If the destination exists it will be completely replaced
1642 by the content copied from the source.</p></div>
1643 <div class="literalblock">
1644 <div class="content">
1645 <pre><code> 'C' SP &lt;path&gt; SP &lt;path&gt; LF</code></pre>
1646 </div></div>
1647 <div class="paragraph"><p>here the first <code>&lt;path&gt;</code> is the source location and the second
1648 <code>&lt;path&gt;</code> is the destination. See <code>filemodify</code> above for a detailed
1649 description of what <code>&lt;path&gt;</code> may look like. To use a source path
1650 that contains SP the path must be quoted.</p></div>
1651 <div class="paragraph"><p>A <code>filecopy</code> command takes effect immediately. Once the source
1652 location has been copied to the destination any future commands
1653 applied to the source location will not impact the destination of
1654 the copy.</p></div>
1655 </div>
1656 <div class="sect3">
1657 <h4 id="_code_filerename_code"><code>filerename</code></h4>
1658 <div class="paragraph"><p>Renames an existing file or subdirectory to a different location
1659 within the branch. The existing file or directory must exist. If
1660 the destination exists it will be replaced by the source directory.</p></div>
1661 <div class="literalblock">
1662 <div class="content">
1663 <pre><code> 'R' SP &lt;path&gt; SP &lt;path&gt; LF</code></pre>
1664 </div></div>
1665 <div class="paragraph"><p>here the first <code>&lt;path&gt;</code> is the source location and the second
1666 <code>&lt;path&gt;</code> is the destination. See <code>filemodify</code> above for a detailed
1667 description of what <code>&lt;path&gt;</code> may look like. To use a source path
1668 that contains SP the path must be quoted.</p></div>
1669 <div class="paragraph"><p>A <code>filerename</code> command takes effect immediately. Once the source
1670 location has been renamed to the destination any future commands
1671 applied to the source location will create new files there and not
1672 impact the destination of the rename.</p></div>
1673 <div class="paragraph"><p>Note that a <code>filerename</code> is the same as a <code>filecopy</code> followed by a
1674 <code>filedelete</code> of the source location. There is a slight performance
1675 advantage to using <code>filerename</code>, but the advantage is so small
1676 that it is never worth trying to convert a delete/add pair in
1677 source material into a rename for fast-import. This <code>filerename</code>
1678 command is provided just to simplify frontends that already have
1679 rename information and don&#8217;t want bother with decomposing it into a
1680 <code>filecopy</code> followed by a <code>filedelete</code>.</p></div>
1681 </div>
1682 <div class="sect3">
1683 <h4 id="_code_filedeleteall_code"><code>filedeleteall</code></h4>
1684 <div class="paragraph"><p>Included in a <code>commit</code> command to remove all files (and also all
1685 directories) from the branch. This command resets the internal
1686 branch structure to have no files in it, allowing the frontend
1687 to subsequently add all interesting files from scratch.</p></div>
1688 <div class="literalblock">
1689 <div class="content">
1690 <pre><code> 'deleteall' LF</code></pre>
1691 </div></div>
1692 <div class="paragraph"><p>This command is extremely useful if the frontend does not know
1693 (or does not care to know) what files are currently on the branch,
1694 and therefore cannot generate the proper <code>filedelete</code> commands to
1695 update the content.</p></div>
1696 <div class="paragraph"><p>Issuing a <code>filedeleteall</code> followed by the needed <code>filemodify</code>
1697 commands to set the correct content will produce the same results
1698 as sending only the needed <code>filemodify</code> and <code>filedelete</code> commands.
1699 The <code>filedeleteall</code> approach may however require fast-import to use slightly
1700 more memory per active branch (less than 1 MiB for even most large
1701 projects); so frontends that can easily obtain only the affected
1702 paths for a commit are encouraged to do so.</p></div>
1703 </div>
1704 <div class="sect3">
1705 <h4 id="_code_notemodify_code"><code>notemodify</code></h4>
1706 <div class="paragraph"><p>Included in a <code>commit</code> <code>&lt;notes-ref&gt;</code> command to add a new note
1707 annotating a <code>&lt;commit-ish&gt;</code> or change this annotation contents.
1708 Internally it is similar to filemodify 100644 on <code>&lt;commit-ish&gt;</code>
1709 path (maybe split into subdirectories). It&#8217;s not advised to
1710 use any other commands to write to the <code>&lt;notes-ref&gt;</code> tree except
1711 <code>filedeleteall</code> to delete all existing notes in this tree.
1712 This command has two different means of specifying the content
1713 of the note.</p></div>
1714 <div class="dlist"><dl>
1715 <dt class="hdlist1">
1716 External data format
1717 </dt>
1718 <dd>
1720 The data content for the note was already supplied by a prior
1721 <code>blob</code> command. The frontend just needs to connect it to the
1722 commit that is to be annotated.
1723 </p>
1724 <div class="literalblock">
1725 <div class="content">
1726 <pre><code> 'N' SP &lt;dataref&gt; SP &lt;commit-ish&gt; LF</code></pre>
1727 </div></div>
1728 <div class="paragraph"><p>Here <code>&lt;dataref&gt;</code> can be either a mark reference (<code>:&lt;idnum&gt;</code>)
1729 set by a prior <code>blob</code> command, or a full 40-byte SHA-1 of an
1730 existing Git blob object.</p></div>
1731 </dd>
1732 <dt class="hdlist1">
1733 Inline data format
1734 </dt>
1735 <dd>
1737 The data content for the note has not been supplied yet.
1738 The frontend wants to supply it as part of this modify
1739 command.
1740 </p>
1741 <div class="literalblock">
1742 <div class="content">
1743 <pre><code> 'N' SP 'inline' SP &lt;commit-ish&gt; LF
1744 data</code></pre>
1745 </div></div>
1746 <div class="paragraph"><p>See below for a detailed description of the <code>data</code> command.</p></div>
1747 </dd>
1748 </dl></div>
1749 <div class="paragraph"><p>In both formats <code>&lt;commit-ish&gt;</code> is any of the commit specification
1750 expressions also accepted by <code>from</code> (see above).</p></div>
1751 </div>
1752 </div>
1753 <div class="sect2">
1754 <h3 id="_code_mark_code"><code>mark</code></h3>
1755 <div class="paragraph"><p>Arranges for fast-import to save a reference to the current object, allowing
1756 the frontend to recall this object at a future point in time, without
1757 knowing its SHA-1. Here the current object is the object creation
1758 command the <code>mark</code> command appears within. This can be <code>commit</code>,
1759 <code>tag</code>, and <code>blob</code>, but <code>commit</code> is the most common usage.</p></div>
1760 <div class="literalblock">
1761 <div class="content">
1762 <pre><code> 'mark' SP ':' &lt;idnum&gt; LF</code></pre>
1763 </div></div>
1764 <div class="paragraph"><p>where <code>&lt;idnum&gt;</code> is the number assigned by the frontend to this mark.
1765 The value of <code>&lt;idnum&gt;</code> is expressed as an ASCII decimal integer.
1766 The value 0 is reserved and cannot be used as
1767 a mark. Only values greater than or equal to 1 may be used as marks.</p></div>
1768 <div class="paragraph"><p>New marks are created automatically. Existing marks can be moved
1769 to another object simply by reusing the same <code>&lt;idnum&gt;</code> in another
1770 <code>mark</code> command.</p></div>
1771 </div>
1772 <div class="sect2">
1773 <h3 id="_code_original_oid_code"><code>original-oid</code></h3>
1774 <div class="paragraph"><p>Provides the name of the object in the original source control system.
1775 fast-import will simply ignore this directive, but filter processes
1776 which operate on and modify the stream before feeding to fast-import
1777 may have uses for this information</p></div>
1778 <div class="literalblock">
1779 <div class="content">
1780 <pre><code> 'original-oid' SP &lt;object-identifier&gt; LF</code></pre>
1781 </div></div>
1782 <div class="paragraph"><p>where <code>&lt;object-identifier&gt;</code> is any string not containing LF.</p></div>
1783 </div>
1784 <div class="sect2">
1785 <h3 id="_code_tag_code"><code>tag</code></h3>
1786 <div class="paragraph"><p>Creates an annotated tag referring to a specific commit. To create
1787 lightweight (non-annotated) tags see the <code>reset</code> command below.</p></div>
1788 <div class="literalblock">
1789 <div class="content">
1790 <pre><code> 'tag' SP &lt;name&gt; LF
1791 mark?
1792 'from' SP &lt;commit-ish&gt; LF
1793 original-oid?
1794 'tagger' (SP &lt;name&gt;)? SP LT &lt;email&gt; GT SP &lt;when&gt; LF
1795 data</code></pre>
1796 </div></div>
1797 <div class="paragraph"><p>where <code>&lt;name&gt;</code> is the name of the tag to create.</p></div>
1798 <div class="paragraph"><p>Tag names are automatically prefixed with <code>refs/tags/</code> when stored
1799 in Git, so importing the CVS branch symbol <code>RELENG-1_0-FINAL</code> would
1800 use just <code>RELENG-1_0-FINAL</code> for <code>&lt;name&gt;</code>, and fast-import will write the
1801 corresponding ref as <code>refs/tags/RELENG-1_0-FINAL</code>.</p></div>
1802 <div class="paragraph"><p>The value of <code>&lt;name&gt;</code> must be a valid refname in Git and therefore
1803 may contain forward slashes. As <code>LF</code> is not valid in a Git refname,
1804 no quoting or escaping syntax is supported here.</p></div>
1805 <div class="paragraph"><p>The <code>from</code> command is the same as in the <code>commit</code> command; see
1806 above for details.</p></div>
1807 <div class="paragraph"><p>The <code>tagger</code> command uses the same format as <code>committer</code> within
1808 <code>commit</code>; again see above for details.</p></div>
1809 <div class="paragraph"><p>The <code>data</code> command following <code>tagger</code> must supply the annotated tag
1810 message (see below for <code>data</code> command syntax). To import an empty
1811 tag message use a 0 length data. Tag messages are free-form and are
1812 not interpreted by Git. Currently they must be encoded in UTF-8,
1813 as fast-import does not permit other encodings to be specified.</p></div>
1814 <div class="paragraph"><p>Signing annotated tags during import from within fast-import is not
1815 supported. Trying to include your own PGP/GPG signature is not
1816 recommended, as the frontend does not (easily) have access to the
1817 complete set of bytes which normally goes into such a signature.
1818 If signing is required, create lightweight tags from within fast-import with
1819 <code>reset</code>, then create the annotated versions of those tags offline
1820 with the standard <em>git tag</em> process.</p></div>
1821 </div>
1822 <div class="sect2">
1823 <h3 id="_code_reset_code"><code>reset</code></h3>
1824 <div class="paragraph"><p>Creates (or recreates) the named branch, optionally starting from
1825 a specific revision. The reset command allows a frontend to issue
1826 a new <code>from</code> command for an existing branch, or to create a new
1827 branch from an existing commit without creating a new commit.</p></div>
1828 <div class="literalblock">
1829 <div class="content">
1830 <pre><code> 'reset' SP &lt;ref&gt; LF
1831 ('from' SP &lt;commit-ish&gt; LF)?
1832 LF?</code></pre>
1833 </div></div>
1834 <div class="paragraph"><p>For a detailed description of <code>&lt;ref&gt;</code> and <code>&lt;commit-ish&gt;</code> see above
1835 under <code>commit</code> and <code>from</code>.</p></div>
1836 <div class="paragraph"><p>The <code>LF</code> after the command is optional (it used to be required).</p></div>
1837 <div class="paragraph"><p>The <code>reset</code> command can also be used to create lightweight
1838 (non-annotated) tags. For example:</p></div>
1839 <div class="exampleblock">
1840 <div class="content">
1841 <div class="literalblock">
1842 <div class="content">
1843 <pre><code>reset refs/tags/938
1844 from :938</code></pre>
1845 </div></div>
1846 </div></div>
1847 <div class="paragraph"><p>would create the lightweight tag <code>refs/tags/938</code> referring to
1848 whatever commit mark <code>:938</code> references.</p></div>
1849 </div>
1850 <div class="sect2">
1851 <h3 id="_code_blob_code"><code>blob</code></h3>
1852 <div class="paragraph"><p>Requests writing one file revision to the packfile. The revision
1853 is not connected to any commit; this connection must be formed in
1854 a subsequent <code>commit</code> command by referencing the blob through an
1855 assigned mark.</p></div>
1856 <div class="literalblock">
1857 <div class="content">
1858 <pre><code> 'blob' LF
1859 mark?
1860 original-oid?
1861 data</code></pre>
1862 </div></div>
1863 <div class="paragraph"><p>The mark command is optional here as some frontends have chosen
1864 to generate the Git SHA-1 for the blob on their own, and feed that
1865 directly to <code>commit</code>. This is typically more work than it&#8217;s worth
1866 however, as marks are inexpensive to store and easy to use.</p></div>
1867 </div>
1868 <div class="sect2">
1869 <h3 id="_code_data_code"><code>data</code></h3>
1870 <div class="paragraph"><p>Supplies raw data (for use as blob/file content, commit messages, or
1871 annotated tag messages) to fast-import. Data can be supplied using an exact
1872 byte count or delimited with a terminating line. Real frontends
1873 intended for production-quality conversions should always use the
1874 exact byte count format, as it is more robust and performs better.
1875 The delimited format is intended primarily for testing fast-import.</p></div>
1876 <div class="paragraph"><p>Comment lines appearing within the <code>&lt;raw&gt;</code> part of <code>data</code> commands
1877 are always taken to be part of the body of the data and are therefore
1878 never ignored by fast-import. This makes it safe to import any
1879 file/message content whose lines might start with <code>#</code>.</p></div>
1880 <div class="dlist"><dl>
1881 <dt class="hdlist1">
1882 Exact byte count format
1883 </dt>
1884 <dd>
1886 The frontend must specify the number of bytes of data.
1887 </p>
1888 <div class="literalblock">
1889 <div class="content">
1890 <pre><code> 'data' SP &lt;count&gt; LF
1891 &lt;raw&gt; LF?</code></pre>
1892 </div></div>
1893 <div class="paragraph"><p>where <code>&lt;count&gt;</code> is the exact number of bytes appearing within
1894 <code>&lt;raw&gt;</code>. The value of <code>&lt;count&gt;</code> is expressed as an ASCII decimal
1895 integer. The <code>LF</code> on either side of <code>&lt;raw&gt;</code> is not
1896 included in <code>&lt;count&gt;</code> and will not be included in the imported data.</p></div>
1897 <div class="paragraph"><p>The <code>LF</code> after <code>&lt;raw&gt;</code> is optional (it used to be required) but
1898 recommended. Always including it makes debugging a fast-import
1899 stream easier as the next command always starts in column 0
1900 of the next line, even if <code>&lt;raw&gt;</code> did not end with an <code>LF</code>.</p></div>
1901 </dd>
1902 <dt class="hdlist1">
1903 Delimited format
1904 </dt>
1905 <dd>
1907 A delimiter string is used to mark the end of the data.
1908 fast-import will compute the length by searching for the delimiter.
1909 This format is primarily useful for testing and is not
1910 recommended for real data.
1911 </p>
1912 <div class="literalblock">
1913 <div class="content">
1914 <pre><code> 'data' SP '&lt;&lt;' &lt;delim&gt; LF
1915 &lt;raw&gt; LF
1916 &lt;delim&gt; LF
1917 LF?</code></pre>
1918 </div></div>
1919 <div class="paragraph"><p>where <code>&lt;delim&gt;</code> is the chosen delimiter string. The string <code>&lt;delim&gt;</code>
1920 must not appear on a line by itself within <code>&lt;raw&gt;</code>, as otherwise
1921 fast-import will think the data ends earlier than it really does. The <code>LF</code>
1922 immediately trailing <code>&lt;raw&gt;</code> is part of <code>&lt;raw&gt;</code>. This is one of
1923 the limitations of the delimited format, it is impossible to supply
1924 a data chunk which does not have an LF as its last byte.</p></div>
1925 <div class="paragraph"><p>The <code>LF</code> after <code>&lt;delim&gt; LF</code> is optional (it used to be required).</p></div>
1926 </dd>
1927 </dl></div>
1928 </div>
1929 <div class="sect2">
1930 <h3 id="_code_alias_code"><code>alias</code></h3>
1931 <div class="paragraph"><p>Record that a mark refers to a given object without first creating any
1932 new object.</p></div>
1933 <div class="literalblock">
1934 <div class="content">
1935 <pre><code> 'alias' LF
1936 mark
1937 'to' SP &lt;commit-ish&gt; LF
1938 LF?</code></pre>
1939 </div></div>
1940 <div class="paragraph"><p>For a detailed description of <code>&lt;commit-ish&gt;</code> see above under <code>from</code>.</p></div>
1941 </div>
1942 <div class="sect2">
1943 <h3 id="_code_checkpoint_code"><code>checkpoint</code></h3>
1944 <div class="paragraph"><p>Forces fast-import to close the current packfile, start a new one, and to
1945 save out all current branch refs, tags and marks.</p></div>
1946 <div class="literalblock">
1947 <div class="content">
1948 <pre><code> 'checkpoint' LF
1949 LF?</code></pre>
1950 </div></div>
1951 <div class="paragraph"><p>Note that fast-import automatically switches packfiles when the current
1952 packfile reaches --max-pack-size, or 4 GiB, whichever limit is
1953 smaller. During an automatic packfile switch fast-import does not update
1954 the branch refs, tags or marks.</p></div>
1955 <div class="paragraph"><p>As a <code>checkpoint</code> can require a significant amount of CPU time and
1956 disk IO (to compute the overall pack SHA-1 checksum, generate the
1957 corresponding index file, and update the refs) it can easily take
1958 several minutes for a single <code>checkpoint</code> command to complete.</p></div>
1959 <div class="paragraph"><p>Frontends may choose to issue checkpoints during extremely large
1960 and long running imports, or when they need to allow another Git
1961 process access to a branch. However given that a 30 GiB Subversion
1962 repository can be loaded into Git through fast-import in about 3 hours,
1963 explicit checkpointing may not be necessary.</p></div>
1964 <div class="paragraph"><p>The <code>LF</code> after the command is optional (it used to be required).</p></div>
1965 </div>
1966 <div class="sect2">
1967 <h3 id="_code_progress_code"><code>progress</code></h3>
1968 <div class="paragraph"><p>Causes fast-import to print the entire <code>progress</code> line unmodified to
1969 its standard output channel (file descriptor 1) when the command is
1970 processed from the input stream. The command otherwise has no impact
1971 on the current import, or on any of fast-import&#8217;s internal state.</p></div>
1972 <div class="literalblock">
1973 <div class="content">
1974 <pre><code> 'progress' SP &lt;any&gt; LF
1975 LF?</code></pre>
1976 </div></div>
1977 <div class="paragraph"><p>The <code>&lt;any&gt;</code> part of the command may contain any sequence of bytes
1978 that does not contain <code>LF</code>. The <code>LF</code> after the command is optional.
1979 Callers may wish to process the output through a tool such as sed to
1980 remove the leading part of the line, for example:</p></div>
1981 <div class="exampleblock">
1982 <div class="content">
1983 <div class="literalblock">
1984 <div class="content">
1985 <pre><code>frontend | git fast-import | sed 's/^progress //'</code></pre>
1986 </div></div>
1987 </div></div>
1988 <div class="paragraph"><p>Placing a <code>progress</code> command immediately after a <code>checkpoint</code> will
1989 inform the reader when the <code>checkpoint</code> has been completed and it
1990 can safely access the refs that fast-import updated.</p></div>
1991 </div>
1992 <div class="sect2">
1993 <h3 id="_code_get_mark_code"><code>get-mark</code></h3>
1994 <div class="paragraph"><p>Causes fast-import to print the SHA-1 corresponding to a mark to
1995 stdout or to the file descriptor previously arranged with the
1996 <code>--cat-blob-fd</code> argument. The command otherwise has no impact on the
1997 current import; its purpose is to retrieve SHA-1s that later commits
1998 might want to refer to in their commit messages.</p></div>
1999 <div class="literalblock">
2000 <div class="content">
2001 <pre><code> 'get-mark' SP ':' &lt;idnum&gt; LF</code></pre>
2002 </div></div>
2003 <div class="paragraph"><p>See &#8220;Responses To Commands&#8221; below for details about how to read
2004 this output safely.</p></div>
2005 </div>
2006 <div class="sect2">
2007 <h3 id="_code_cat_blob_code"><code>cat-blob</code></h3>
2008 <div class="paragraph"><p>Causes fast-import to print a blob to a file descriptor previously
2009 arranged with the <code>--cat-blob-fd</code> argument. The command otherwise
2010 has no impact on the current import; its main purpose is to
2011 retrieve blobs that may be in fast-import&#8217;s memory but not
2012 accessible from the target repository.</p></div>
2013 <div class="literalblock">
2014 <div class="content">
2015 <pre><code> 'cat-blob' SP &lt;dataref&gt; LF</code></pre>
2016 </div></div>
2017 <div class="paragraph"><p>The <code>&lt;dataref&gt;</code> can be either a mark reference (<code>:&lt;idnum&gt;</code>)
2018 set previously or a full 40-byte SHA-1 of a Git blob, preexisting or
2019 ready to be written.</p></div>
2020 <div class="paragraph"><p>Output uses the same format as <code>git cat-file --batch</code>:</p></div>
2021 <div class="exampleblock">
2022 <div class="content">
2023 <div class="literalblock">
2024 <div class="content">
2025 <pre><code>&lt;sha1&gt; SP 'blob' SP &lt;size&gt; LF
2026 &lt;contents&gt; LF</code></pre>
2027 </div></div>
2028 </div></div>
2029 <div class="paragraph"><p>This command can be used where a <code>filemodify</code> directive can appear,
2030 allowing it to be used in the middle of a commit. For a <code>filemodify</code>
2031 using an inline directive, it can also appear right before the <code>data</code>
2032 directive.</p></div>
2033 <div class="paragraph"><p>See &#8220;Responses To Commands&#8221; below for details about how to read
2034 this output safely.</p></div>
2035 </div>
2036 <div class="sect2">
2037 <h3 id="_code_ls_code"><code>ls</code></h3>
2038 <div class="paragraph"><p>Prints information about the object at a path to a file descriptor
2039 previously arranged with the <code>--cat-blob-fd</code> argument. This allows
2040 printing a blob from the active commit (with <code>cat-blob</code>) or copying a
2041 blob or tree from a previous commit for use in the current one (with
2042 <code>filemodify</code>).</p></div>
2043 <div class="paragraph"><p>The <code>ls</code> command can also be used where a <code>filemodify</code> directive can
2044 appear, allowing it to be used in the middle of a commit.</p></div>
2045 <div class="dlist"><dl>
2046 <dt class="hdlist1">
2047 Reading from the active commit
2048 </dt>
2049 <dd>
2051 This form can only be used in the middle of a <code>commit</code>.
2052 The path names a directory entry within fast-import&#8217;s
2053 active commit. The path must be quoted in this case.
2054 </p>
2055 <div class="literalblock">
2056 <div class="content">
2057 <pre><code> 'ls' SP &lt;path&gt; LF</code></pre>
2058 </div></div>
2059 </dd>
2060 <dt class="hdlist1">
2061 Reading from a named tree
2062 </dt>
2063 <dd>
2065 The <code>&lt;dataref&gt;</code> can be a mark reference (<code>:&lt;idnum&gt;</code>) or the
2066 full 40-byte SHA-1 of a Git tag, commit, or tree object,
2067 preexisting or waiting to be written.
2068 The path is relative to the top level of the tree
2069 named by <code>&lt;dataref&gt;</code>.
2070 </p>
2071 <div class="literalblock">
2072 <div class="content">
2073 <pre><code> 'ls' SP &lt;dataref&gt; SP &lt;path&gt; LF</code></pre>
2074 </div></div>
2075 </dd>
2076 </dl></div>
2077 <div class="paragraph"><p>See <code>filemodify</code> above for a detailed description of <code>&lt;path&gt;</code>.</p></div>
2078 <div class="paragraph"><p>Output uses the same format as <code>git ls-tree &lt;tree&gt; -- &lt;path&gt;</code>:</p></div>
2079 <div class="exampleblock">
2080 <div class="content">
2081 <div class="literalblock">
2082 <div class="content">
2083 <pre><code>&lt;mode&gt; SP ('blob' | 'tree' | 'commit') SP &lt;dataref&gt; HT &lt;path&gt; LF</code></pre>
2084 </div></div>
2085 </div></div>
2086 <div class="paragraph"><p>The &lt;dataref&gt; represents the blob, tree, or commit object at &lt;path&gt;
2087 and can be used in later <em>get-mark</em>, <em>cat-blob</em>, <em>filemodify</em>, or
2088 <em>ls</em> commands.</p></div>
2089 <div class="paragraph"><p>If there is no file or subtree at that path, <em>git fast-import</em> will
2090 instead report</p></div>
2091 <div class="exampleblock">
2092 <div class="content">
2093 <div class="literalblock">
2094 <div class="content">
2095 <pre><code>missing SP &lt;path&gt; LF</code></pre>
2096 </div></div>
2097 </div></div>
2098 <div class="paragraph"><p>See &#8220;Responses To Commands&#8221; below for details about how to read
2099 this output safely.</p></div>
2100 </div>
2101 <div class="sect2">
2102 <h3 id="_code_feature_code"><code>feature</code></h3>
2103 <div class="paragraph"><p>Require that fast-import supports the specified feature, or abort if
2104 it does not.</p></div>
2105 <div class="literalblock">
2106 <div class="content">
2107 <pre><code> 'feature' SP &lt;feature&gt; ('=' &lt;argument&gt;)? LF</code></pre>
2108 </div></div>
2109 <div class="paragraph"><p>The &lt;feature&gt; part of the command may be any one of the following:</p></div>
2110 <div class="dlist"><dl>
2111 <dt class="hdlist1">
2112 date-format
2113 </dt>
2114 <dt class="hdlist1">
2115 export-marks
2116 </dt>
2117 <dt class="hdlist1">
2118 relative-marks
2119 </dt>
2120 <dt class="hdlist1">
2121 no-relative-marks
2122 </dt>
2123 <dt class="hdlist1">
2124 force
2125 </dt>
2126 <dd>
2128 Act as though the corresponding command-line option with
2129 a leading <code>--</code> was passed on the command line
2130 (see OPTIONS, above).
2131 </p>
2132 </dd>
2133 <dt class="hdlist1">
2134 import-marks
2135 </dt>
2136 <dt class="hdlist1">
2137 import-marks-if-exists
2138 </dt>
2139 <dd>
2141 Like --import-marks except in two respects: first, only one
2142 "feature import-marks" or "feature import-marks-if-exists"
2143 command is allowed per stream; second, an --import-marks=
2144 or --import-marks-if-exists command-line option overrides
2145 any of these "feature" commands in the stream; third,
2146 "feature import-marks-if-exists" like a corresponding
2147 command-line option silently skips a nonexistent file.
2148 </p>
2149 </dd>
2150 <dt class="hdlist1">
2151 get-mark
2152 </dt>
2153 <dt class="hdlist1">
2154 cat-blob
2155 </dt>
2156 <dt class="hdlist1">
2158 </dt>
2159 <dd>
2161 Require that the backend support the <em>get-mark</em>, <em>cat-blob</em>,
2162 or <em>ls</em> command respectively.
2163 Versions of fast-import not supporting the specified command
2164 will exit with a message indicating so.
2165 This lets the import error out early with a clear message,
2166 rather than wasting time on the early part of an import
2167 before the unsupported command is detected.
2168 </p>
2169 </dd>
2170 <dt class="hdlist1">
2171 notes
2172 </dt>
2173 <dd>
2175 Require that the backend support the <em>notemodify</em> (N)
2176 subcommand to the <em>commit</em> command.
2177 Versions of fast-import not supporting notes will exit
2178 with a message indicating so.
2179 </p>
2180 </dd>
2181 <dt class="hdlist1">
2182 done
2183 </dt>
2184 <dd>
2186 Error out if the stream ends without a <em>done</em> command.
2187 Without this feature, errors causing the frontend to end
2188 abruptly at a convenient point in the stream can go
2189 undetected. This may occur, for example, if an import
2190 front end dies in mid-operation without emitting SIGTERM
2191 or SIGKILL at its subordinate git fast-import instance.
2192 </p>
2193 </dd>
2194 </dl></div>
2195 </div>
2196 <div class="sect2">
2197 <h3 id="_code_option_code"><code>option</code></h3>
2198 <div class="paragraph"><p>Processes the specified option so that git fast-import behaves in a
2199 way that suits the frontend&#8217;s needs.
2200 Note that options specified by the frontend are overridden by any
2201 options the user may specify to git fast-import itself.</p></div>
2202 <div class="literalblock">
2203 <div class="content">
2204 <pre><code> 'option' SP &lt;option&gt; LF</code></pre>
2205 </div></div>
2206 <div class="paragraph"><p>The <code>&lt;option&gt;</code> part of the command may contain any of the options
2207 listed in the OPTIONS section that do not change import semantics,
2208 without the leading <code>--</code> and is treated in the same way.</p></div>
2209 <div class="paragraph"><p>Option commands must be the first commands on the input (not counting
2210 feature commands), to give an option command after any non-option
2211 command is an error.</p></div>
2212 <div class="paragraph"><p>The following command-line options change import semantics and may therefore
2213 not be passed as option:</p></div>
2214 <div class="ulist"><ul>
2215 <li>
2217 date-format
2218 </p>
2219 </li>
2220 <li>
2222 import-marks
2223 </p>
2224 </li>
2225 <li>
2227 export-marks
2228 </p>
2229 </li>
2230 <li>
2232 cat-blob-fd
2233 </p>
2234 </li>
2235 <li>
2237 force
2238 </p>
2239 </li>
2240 </ul></div>
2241 </div>
2242 <div class="sect2">
2243 <h3 id="_code_done_code"><code>done</code></h3>
2244 <div class="paragraph"><p>If the <code>done</code> feature is not in use, treated as if EOF was read.
2245 This can be used to tell fast-import to finish early.</p></div>
2246 <div class="paragraph"><p>If the <code>--done</code> command-line option or <code>feature done</code> command is
2247 in use, the <code>done</code> command is mandatory and marks the end of the
2248 stream.</p></div>
2249 </div>
2250 </div>
2251 </div>
2252 <div class="sect1">
2253 <h2 id="_responses_to_commands">RESPONSES TO COMMANDS</h2>
2254 <div class="sectionbody">
2255 <div class="paragraph"><p>New objects written by fast-import are not available immediately.
2256 Most fast-import commands have no visible effect until the next
2257 checkpoint (or completion). The frontend can send commands to
2258 fill fast-import&#8217;s input pipe without worrying about how quickly
2259 they will take effect, which improves performance by simplifying
2260 scheduling.</p></div>
2261 <div class="paragraph"><p>For some frontends, though, it is useful to be able to read back
2262 data from the current repository as it is being updated (for
2263 example when the source material describes objects in terms of
2264 patches to be applied to previously imported objects). This can
2265 be accomplished by connecting the frontend and fast-import via
2266 bidirectional pipes:</p></div>
2267 <div class="exampleblock">
2268 <div class="content">
2269 <div class="literalblock">
2270 <div class="content">
2271 <pre><code>mkfifo fast-import-output
2272 frontend &lt;fast-import-output |
2273 git fast-import &gt;fast-import-output</code></pre>
2274 </div></div>
2275 </div></div>
2276 <div class="paragraph"><p>A frontend set up this way can use <code>progress</code>, <code>get-mark</code>, <code>ls</code>, and
2277 <code>cat-blob</code> commands to read information from the import in progress.</p></div>
2278 <div class="paragraph"><p>To avoid deadlock, such frontends must completely consume any
2279 pending output from <code>progress</code>, <code>ls</code>, <code>get-mark</code>, and <code>cat-blob</code> before
2280 performing writes to fast-import that might block.</p></div>
2281 </div>
2282 </div>
2283 <div class="sect1">
2284 <h2 id="_crash_reports">CRASH REPORTS</h2>
2285 <div class="sectionbody">
2286 <div class="paragraph"><p>If fast-import is supplied invalid input it will terminate with a
2287 non-zero exit status and create a crash report in the top level of
2288 the Git repository it was importing into. Crash reports contain
2289 a snapshot of the internal fast-import state as well as the most
2290 recent commands that lead up to the crash.</p></div>
2291 <div class="paragraph"><p>All recent commands (including stream comments, file changes and
2292 progress commands) are shown in the command history within the crash
2293 report, but raw file data and commit messages are excluded from the
2294 crash report. This exclusion saves space within the report file
2295 and reduces the amount of buffering that fast-import must perform
2296 during execution.</p></div>
2297 <div class="paragraph"><p>After writing a crash report fast-import will close the current
2298 packfile and export the marks table. This allows the frontend
2299 developer to inspect the repository state and resume the import from
2300 the point where it crashed. The modified branches and tags are not
2301 updated during a crash, as the import did not complete successfully.
2302 Branch and tag information can be found in the crash report and
2303 must be applied manually if the update is needed.</p></div>
2304 <div class="paragraph"><p>An example crash:</p></div>
2305 <div class="exampleblock">
2306 <div class="content">
2307 <div class="literalblock">
2308 <div class="content">
2309 <pre><code>$ cat &gt;in &lt;&lt;END_OF_INPUT
2310 # my very first test commit
2311 commit refs/heads/master
2312 committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400
2313 # who is that guy anyway?
2314 data &lt;&lt;EOF
2315 this is my commit
2317 M 644 inline .gitignore
2318 data &lt;&lt;EOF
2319 .gitignore
2321 M 777 inline bob
2322 END_OF_INPUT</code></pre>
2323 </div></div>
2324 <div class="literalblock">
2325 <div class="content">
2326 <pre><code>$ git fast-import &lt;in
2327 fatal: Corrupt mode: M 777 inline bob
2328 fast-import: dumping crash report to .git/fast_import_crash_8434</code></pre>
2329 </div></div>
2330 <div class="literalblock">
2331 <div class="content">
2332 <pre><code>$ cat .git/fast_import_crash_8434
2333 fast-import crash report:
2334 fast-import process: 8434
2335 parent process : 1391
2336 at Sat Sep 1 00:58:12 2007</code></pre>
2337 </div></div>
2338 <div class="literalblock">
2339 <div class="content">
2340 <pre><code>fatal: Corrupt mode: M 777 inline bob</code></pre>
2341 </div></div>
2342 <div class="literalblock">
2343 <div class="content">
2344 <pre><code>Most Recent Commands Before Crash
2345 ---------------------------------
2346 # my very first test commit
2347 commit refs/heads/master
2348 committer Shawn O. Pearce &lt;spearce&gt; 19283 -0400
2349 # who is that guy anyway?
2350 data &lt;&lt;EOF
2351 M 644 inline .gitignore
2352 data &lt;&lt;EOF
2353 * M 777 inline bob</code></pre>
2354 </div></div>
2355 <div class="literalblock">
2356 <div class="content">
2357 <pre><code>Active Branch LRU
2358 -----------------
2359 active_branches = 1 cur, 5 max</code></pre>
2360 </div></div>
2361 <div class="literalblock">
2362 <div class="content">
2363 <pre><code>pos clock name
2364 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2365 1) 0 refs/heads/master</code></pre>
2366 </div></div>
2367 <div class="literalblock">
2368 <div class="content">
2369 <pre><code>Inactive Branches
2370 -----------------
2371 refs/heads/master:
2372 status : active loaded dirty
2373 tip commit : 0000000000000000000000000000000000000000
2374 old tree : 0000000000000000000000000000000000000000
2375 cur tree : 0000000000000000000000000000000000000000
2376 commit clock: 0
2377 last pack :</code></pre>
2378 </div></div>
2379 <div class="literalblock">
2380 <div class="content">
2381 <pre><code>-------------------
2382 END OF CRASH REPORT</code></pre>
2383 </div></div>
2384 </div></div>
2385 </div>
2386 </div>
2387 <div class="sect1">
2388 <h2 id="_tips_and_tricks">TIPS AND TRICKS</h2>
2389 <div class="sectionbody">
2390 <div class="paragraph"><p>The following tips and tricks have been collected from various
2391 users of fast-import, and are offered here as suggestions.</p></div>
2392 <div class="sect2">
2393 <h3 id="_use_one_mark_per_commit">Use One Mark Per Commit</h3>
2394 <div class="paragraph"><p>When doing a repository conversion, use a unique mark per commit
2395 (<code>mark :&lt;n&gt;</code>) and supply the --export-marks option on the command
2396 line. fast-import will dump a file which lists every mark and the Git
2397 object SHA-1 that corresponds to it. If the frontend can tie
2398 the marks back to the source repository, it is easy to verify the
2399 accuracy and completeness of the import by comparing each Git
2400 commit to the corresponding source revision.</p></div>
2401 <div class="paragraph"><p>Coming from a system such as Perforce or Subversion, this should be
2402 quite simple, as the fast-import mark can also be the Perforce changeset
2403 number or the Subversion revision number.</p></div>
2404 </div>
2405 <div class="sect2">
2406 <h3 id="_freely_skip_around_branches">Freely Skip Around Branches</h3>
2407 <div class="paragraph"><p>Don&#8217;t bother trying to optimize the frontend to stick to one branch
2408 at a time during an import. Although doing so might be slightly
2409 faster for fast-import, it tends to increase the complexity of the frontend
2410 code considerably.</p></div>
2411 <div class="paragraph"><p>The branch LRU builtin to fast-import tends to behave very well, and the
2412 cost of activating an inactive branch is so low that bouncing around
2413 between branches has virtually no impact on import performance.</p></div>
2414 </div>
2415 <div class="sect2">
2416 <h3 id="_handling_renames">Handling Renames</h3>
2417 <div class="paragraph"><p>When importing a renamed file or directory, simply delete the old
2418 name(s) and modify the new name(s) during the corresponding commit.
2419 Git performs rename detection after-the-fact, rather than explicitly
2420 during a commit.</p></div>
2421 </div>
2422 <div class="sect2">
2423 <h3 id="_use_tag_fixup_branches">Use Tag Fixup Branches</h3>
2424 <div class="paragraph"><p>Some other SCM systems let the user create a tag from multiple
2425 files which are not from the same commit/changeset. Or to create
2426 tags which are a subset of the files available in the repository.</p></div>
2427 <div class="paragraph"><p>Importing these tags as-is in Git is impossible without making at
2428 least one commit which &#8220;fixes up&#8221; the files to match the content
2429 of the tag. Use fast-import&#8217;s <code>reset</code> command to reset a dummy branch
2430 outside of your normal branch space to the base commit for the tag,
2431 then commit one or more file fixup commits, and finally tag the
2432 dummy branch.</p></div>
2433 <div class="paragraph"><p>For example since all normal branches are stored under <code>refs/heads/</code>
2434 name the tag fixup branch <code>TAG_FIXUP</code>. This way it is impossible for
2435 the fixup branch used by the importer to have namespace conflicts
2436 with real branches imported from the source (the name <code>TAG_FIXUP</code>
2437 is not <code>refs/heads/TAG_FIXUP</code>).</p></div>
2438 <div class="paragraph"><p>When committing fixups, consider using <code>merge</code> to connect the
2439 commit(s) which are supplying file revisions to the fixup branch.
2440 Doing so will allow tools such as <em>git blame</em> to track
2441 through the real commit history and properly annotate the source
2442 files.</p></div>
2443 <div class="paragraph"><p>After fast-import terminates the frontend will need to do <code>rm .git/TAG_FIXUP</code>
2444 to remove the dummy branch.</p></div>
2445 </div>
2446 <div class="sect2">
2447 <h3 id="_import_now_repack_later">Import Now, Repack Later</h3>
2448 <div class="paragraph"><p>As soon as fast-import completes the Git repository is completely valid
2449 and ready for use. Typically this takes only a very short time,
2450 even for considerably large projects (100,000+ commits).</p></div>
2451 <div class="paragraph"><p>However repacking the repository is necessary to improve data
2452 locality and access performance. It can also take hours on extremely
2453 large projects (especially if -f and a large --window parameter is
2454 used). Since repacking is safe to run alongside readers and writers,
2455 run the repack in the background and let it finish when it finishes.
2456 There is no reason to wait to explore your new Git project!</p></div>
2457 <div class="paragraph"><p>If you choose to wait for the repack, don&#8217;t try to run benchmarks
2458 or performance tests until repacking is completed. fast-import outputs
2459 suboptimal packfiles that are simply never seen in real use
2460 situations.</p></div>
2461 </div>
2462 <div class="sect2">
2463 <h3 id="_repacking_historical_data">Repacking Historical Data</h3>
2464 <div class="paragraph"><p>If you are repacking very old imported data (e.g. older than the
2465 last year), consider expending some extra CPU time and supplying
2466 --window=50 (or higher) when you run <em>git repack</em>.
2467 This will take longer, but will also produce a smaller packfile.
2468 You only need to expend the effort once, and everyone using your
2469 project will benefit from the smaller repository.</p></div>
2470 </div>
2471 <div class="sect2">
2472 <h3 id="_include_some_progress_messages">Include Some Progress Messages</h3>
2473 <div class="paragraph"><p>Every once in a while have your frontend emit a <code>progress</code> message
2474 to fast-import. The contents of the messages are entirely free-form,
2475 so one suggestion would be to output the current month and year
2476 each time the current commit date moves into the next month.
2477 Your users will feel better knowing how much of the data stream
2478 has been processed.</p></div>
2479 </div>
2480 </div>
2481 </div>
2482 <div class="sect1">
2483 <h2 id="_packfile_optimization">PACKFILE OPTIMIZATION</h2>
2484 <div class="sectionbody">
2485 <div class="paragraph"><p>When packing a blob fast-import always attempts to deltify against the last
2486 blob written. Unless specifically arranged for by the frontend,
2487 this will probably not be a prior version of the same file, so the
2488 generated delta will not be the smallest possible. The resulting
2489 packfile will be compressed, but will not be optimal.</p></div>
2490 <div class="paragraph"><p>Frontends which have efficient access to all revisions of a
2491 single file (for example reading an RCS/CVS ,v file) can choose
2492 to supply all revisions of that file as a sequence of consecutive
2493 <code>blob</code> commands. This allows fast-import to deltify the different file
2494 revisions against each other, saving space in the final packfile.
2495 Marks can be used to later identify individual file revisions during
2496 a sequence of <code>commit</code> commands.</p></div>
2497 <div class="paragraph"><p>The packfile(s) created by fast-import do not encourage good disk access
2498 patterns. This is caused by fast-import writing the data in the order
2499 it is received on standard input, while Git typically organizes
2500 data within packfiles to make the most recent (current tip) data
2501 appear before historical data. Git also clusters commits together,
2502 speeding up revision traversal through better cache locality.</p></div>
2503 <div class="paragraph"><p>For this reason it is strongly recommended that users repack the
2504 repository with <code>git repack -a -d</code> after fast-import completes, allowing
2505 Git to reorganize the packfiles for faster data access. If blob
2506 deltas are suboptimal (see above) then also adding the <code>-f</code> option
2507 to force recomputation of all deltas can significantly reduce the
2508 final packfile size (30-50% smaller can be quite typical).</p></div>
2509 <div class="paragraph"><p>Instead of running <code>git repack</code> you can also run <code>git gc
2510 --aggressive</code>, which will also optimize other things after an import
2511 (e.g. pack loose refs). As noted in the "AGGRESSIVE" section in
2512 <a href="git-gc.html">git-gc(1)</a> the <code>--aggressive</code> option will find new deltas with
2513 the <code>-f</code> option to <a href="git-repack.html">git-repack(1)</a>. For the reasons elaborated
2514 on above using <code>--aggressive</code> after a fast-import is one of the few
2515 cases where it&#8217;s known to be worthwhile.</p></div>
2516 </div>
2517 </div>
2518 <div class="sect1">
2519 <h2 id="_memory_utilization">MEMORY UTILIZATION</h2>
2520 <div class="sectionbody">
2521 <div class="paragraph"><p>There are a number of factors which affect how much memory fast-import
2522 requires to perform an import. Like critical sections of core
2523 Git, fast-import uses its own memory allocators to amortize any overheads
2524 associated with malloc. In practice fast-import tends to amortize any
2525 malloc overheads to 0, due to its use of large block allocations.</p></div>
2526 <div class="sect2">
2527 <h3 id="_per_object">per object</h3>
2528 <div class="paragraph"><p>fast-import maintains an in-memory structure for every object written in
2529 this execution. On a 32 bit system the structure is 32 bytes,
2530 on a 64 bit system the structure is 40 bytes (due to the larger
2531 pointer sizes). Objects in the table are not deallocated until
2532 fast-import terminates. Importing 2 million objects on a 32 bit system
2533 will require approximately 64 MiB of memory.</p></div>
2534 <div class="paragraph"><p>The object table is actually a hashtable keyed on the object name
2535 (the unique SHA-1). This storage configuration allows fast-import to reuse
2536 an existing or already written object and avoid writing duplicates
2537 to the output packfile. Duplicate blobs are surprisingly common
2538 in an import, typically due to branch merges in the source.</p></div>
2539 </div>
2540 <div class="sect2">
2541 <h3 id="_per_mark">per mark</h3>
2542 <div class="paragraph"><p>Marks are stored in a sparse array, using 1 pointer (4 bytes or 8
2543 bytes, depending on pointer size) per mark. Although the array
2544 is sparse, frontends are still strongly encouraged to use marks
2545 between 1 and n, where n is the total number of marks required for
2546 this import.</p></div>
2547 </div>
2548 <div class="sect2">
2549 <h3 id="_per_branch">per branch</h3>
2550 <div class="paragraph"><p>Branches are classified as active and inactive. The memory usage
2551 of the two classes is significantly different.</p></div>
2552 <div class="paragraph"><p>Inactive branches are stored in a structure which uses 96 or 120
2553 bytes (32 bit or 64 bit systems, respectively), plus the length of
2554 the branch name (typically under 200 bytes), per branch. fast-import will
2555 easily handle as many as 10,000 inactive branches in under 2 MiB
2556 of memory.</p></div>
2557 <div class="paragraph"><p>Active branches have the same overhead as inactive branches, but
2558 also contain copies of every tree that has been recently modified on
2559 that branch. If subtree <code>include</code> has not been modified since the
2560 branch became active, its contents will not be loaded into memory,
2561 but if subtree <code>src</code> has been modified by a commit since the branch
2562 became active, then its contents will be loaded in memory.</p></div>
2563 <div class="paragraph"><p>As active branches store metadata about the files contained on that
2564 branch, their in-memory storage size can grow to a considerable size
2565 (see below).</p></div>
2566 <div class="paragraph"><p>fast-import automatically moves active branches to inactive status based on
2567 a simple least-recently-used algorithm. The LRU chain is updated on
2568 each <code>commit</code> command. The maximum number of active branches can be
2569 increased or decreased on the command line with --active-branches=.</p></div>
2570 </div>
2571 <div class="sect2">
2572 <h3 id="_per_active_tree">per active tree</h3>
2573 <div class="paragraph"><p>Trees (aka directories) use just 12 bytes of memory on top of the
2574 memory required for their entries (see &#8220;per active file&#8221; below).
2575 The cost of a tree is virtually 0, as its overhead amortizes out
2576 over the individual file entries.</p></div>
2577 </div>
2578 <div class="sect2">
2579 <h3 id="_per_active_file_entry">per active file entry</h3>
2580 <div class="paragraph"><p>Files (and pointers to subtrees) within active trees require 52 or 64
2581 bytes (32/64 bit platforms) per entry. To conserve space, file and
2582 tree names are pooled in a common string table, allowing the filename
2583 &#8220;Makefile&#8221; to use just 16 bytes (after including the string header
2584 overhead) no matter how many times it occurs within the project.</p></div>
2585 <div class="paragraph"><p>The active branch LRU, when coupled with the filename string pool
2586 and lazy loading of subtrees, allows fast-import to efficiently import
2587 projects with 2,000+ branches and 45,114+ files in a very limited
2588 memory footprint (less than 2.7 MiB per active branch).</p></div>
2589 </div>
2590 </div>
2591 </div>
2592 <div class="sect1">
2593 <h2 id="_signals">SIGNALS</h2>
2594 <div class="sectionbody">
2595 <div class="paragraph"><p>Sending <strong>SIGUSR1</strong> to the <em>git fast-import</em> process ends the current
2596 packfile early, simulating a <code>checkpoint</code> command. The impatient
2597 operator can use this facility to peek at the objects and refs from an
2598 import in progress, at the cost of some added running time and worse
2599 compression.</p></div>
2600 </div>
2601 </div>
2602 <div class="sect1">
2603 <h2 id="_configuration">CONFIGURATION</h2>
2604 <div class="sectionbody">
2605 <div class="paragraph"><p>Everything below this line in this section is selectively included
2606 from the <a href="git-config.html">git-config(1)</a> documentation. The content is the same
2607 as what&#8217;s found there:</p></div>
2608 <div class="dlist"><dl>
2609 <dt class="hdlist1">
2610 fastimport.unpackLimit
2611 </dt>
2612 <dd>
2614 If the number of objects imported by <a href="git-fast-import.html">git-fast-import(1)</a>
2615 is below this limit, then the objects will be unpacked into
2616 loose object files. However, if the number of imported objects
2617 equals or exceeds this limit, then the pack will be stored as a
2618 pack. Storing the pack from a fast-import can make the import
2619 operation complete faster, especially on slow filesystems. If
2620 not set, the value of <code>transfer.unpackLimit</code> is used instead.
2621 </p>
2622 </dd>
2623 </dl></div>
2624 </div>
2625 </div>
2626 <div class="sect1">
2627 <h2 id="_see_also">SEE ALSO</h2>
2628 <div class="sectionbody">
2629 <div class="paragraph"><p><a href="git-fast-export.html">git-fast-export(1)</a></p></div>
2630 </div>
2631 </div>
2632 <div class="sect1">
2633 <h2 id="_git">GIT</h2>
2634 <div class="sectionbody">
2635 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
2636 </div>
2637 </div>
2638 </div>
2639 <div id="footnotes"><hr /></div>
2640 <div id="footer">
2641 <div id="footer-text">
2642 Last updated
2643 2024-02-08 15:45:59 PST
2644 </div>
2645 </div>
2646 </body>
2647 </html>