{
    "content": [
        {
            "type": "text",
            "text": "# git-fast-import(1) (man)\n\n**Summary:** git-fast-import - Backend for fast Git data importers\n\n**Synopsis:** frontend | git fast-import [<options>]\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| — | --force | — | Force updating modified existing branches, even if doing so would cause commits to be lost (as the new commit does not c |\n| — | --quiet | — | Disable the output shown by --stats, making fast-import usually be silent when it is successful. However, if the import  |\n| — | --stats | — | Display some basic statistics about the objects fast-import has created, the packfiles they were stored into, and the me |\n| — | --allow-unsafe-features | — | Many command-line options can be provided as part of the fast-import stream itself by using the feature or option comman |\n| — | --done | — | Terminate with error if there is no done command at the end of the stream. This option might be useful for detecting err |\n\n## See Also\n\n- git-fast-export(1)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (3 lines)\n- **DESCRIPTION** (14 lines)\n- **OPTIONS** (1 lines) — 9 subsections\n  - --force (3 lines)\n  - --quiet (4 lines)\n  - --stats (4 lines)\n  - --allow-unsafe-features (12 lines)\n  - Options for Frontends (10 lines)\n  - --done (4 lines)\n  - Locations of Marks Files (26 lines)\n  - Submodule Rewriting (15 lines)\n  - Performance and Compression Tuning (25 lines)\n- **PERFORMANCE** (11 lines)\n- **DEVELOPMENT COST** (6 lines)\n- **PARALLEL OPERATION** (15 lines)\n- **TECHNICAL DISCUSSION** (13 lines)\n- **INPUT FORMAT** (11 lines) — 45 subsections\n  - Stream Comments (6 lines)\n  - Date Formats (3 lines)\n  - raw (20 lines)\n  - raw-permissive (4 lines)\n  - rfc2822 (23 lines)\n  - now (16 lines)\n  - Commands (3 lines)\n  - commit (3 lines)\n  - tag (4 lines)\n  - reset (3 lines)\n  - blob (3 lines)\n  - alias (5 lines)\n  - checkpoint (4 lines)\n  - progress (3 lines)\n  - done (3 lines)\n  - get-mark (3 lines)\n  - cat-blob (7 lines)\n  - feature (3 lines)\n  - option (4 lines)\n  - commit (40 lines)\n  - author (5 lines)\n  - committer (12 lines)\n  - encoding (4 lines)\n  - from (48 lines)\n  - merge (9 lines)\n  - filemodify (66 lines)\n  - filedelete (10 lines)\n  - filecopy (14 lines)\n  - filerename (21 lines)\n  - filedeleteall (17 lines)\n  - notemodify (28 lines)\n  - mark (14 lines)\n  - original-oid (8 lines)\n  - tag (35 lines)\n  - reset (20 lines)\n  - blob (13 lines)\n  - data (42 lines)\n  - alias (9 lines)\n  - checkpoint (21 lines)\n  - progress (16 lines)\n  - get-mark (9 lines)\n  - cat-blob (58 lines)\n  - feature (33 lines)\n  - option (25 lines)\n  - done (6 lines)\n- **RESPONSES TO COMMANDS** (20 lines)\n- **CRASH REPORTS** (77 lines)\n- **TIPS AND TRICKS** (3 lines) — 7 subsections\n  - Use One Mark Per Commit (9 lines)\n  - Freely Skip Around Branches (8 lines)\n  - Handling Renames (4 lines)\n  - Use Tag Fixup Branches (21 lines)\n  - Import Now, Repack Later (14 lines)\n  - Repacking Historical Data (5 lines)\n  - Include Some Progress Messages (5 lines)\n- **PACKFILE OPTIMIZATION** (18 lines) — 1 subsections\n  - -a -d (10 lines)\n- **MEMORY UTILIZATION** (5 lines) — 5 subsections\n  - per object (11 lines)\n  - per mark (4 lines)\n  - per branch (22 lines)\n  - per active tree (4 lines)\n  - per active file entry (9 lines)\n- **SIGNALS** (5 lines)\n- **SEE ALSO** (2 lines)\n- **GIT** (5 lines)\n\n## Full Content\n\n### NAME\n\ngit-fast-import - Backend for fast Git data importers\n\n### SYNOPSIS\n\nfrontend | git fast-import [<options>]\n\n### DESCRIPTION\n\nThis program is usually not what the end user wants to run directly. Most end users want to\nuse one of the existing frontend programs, which parses a specific type of foreign source and\nfeeds the contents stored there to git fast-import.\n\nfast-import reads a mixed command/data stream from standard input and writes one or more\npackfiles directly into the current repository. When EOF is received on standard input, fast\nimport writes out updated branch and tag refs, fully updating the current repository with the\nnewly imported data.\n\nThe fast-import backend itself can import into an empty repository (one that has already been\ninitialized by git init) or incrementally update an existing populated repository. Whether or\nnot incremental imports are supported from a particular foreign source depends on the\nfrontend program in use.\n\n### OPTIONS\n\n#### --force\n\nForce updating modified existing branches, even if doing so would cause commits to be\nlost (as the new commit does not contain the old commit).\n\n#### --quiet\n\nDisable the output shown by --stats, making fast-import usually be silent when it is\nsuccessful. However, if the import stream has directives intended to show user output\n(e.g.  progress directives), the corresponding messages will still be shown.\n\n#### --stats\n\nDisplay some basic statistics about the objects fast-import has created, the packfiles\nthey were stored into, and the memory used by fast-import during this run. Showing this\noutput is currently the default, but can be disabled with --quiet.\n\n#### --allow-unsafe-features\n\nMany command-line options can be provided as part of the fast-import stream itself by\nusing the feature or option commands. However, some of these options are unsafe (e.g.,\nallowing fast-import to access the filesystem outside of the repository). These options\nare disabled by default, but can be allowed by providing this option on the command line.\nThis currently impacts only the export-marks, import-marks, and import-marks-if-exists\nfeature commands.\n\nOnly enable this option if you trust the program generating the\nfast-import stream! This option is enabled automatically for\nremote-helpers that use the `import` capability, as they are\nalready trusted to run their own code.\n\n#### Options for Frontends\n\n--cat-blob-fd=<fd>\nWrite responses to get-mark, cat-blob, and ls queries to the file descriptor <fd> instead\nof stdout. Allows progress output intended for the end-user to be separated from other\noutput.\n\n--date-format=<fmt>\nSpecify the type of dates the frontend will supply to fast-import within author,\ncommitter and tagger commands. See “Date Formats” below for details about which formats\nare supported, and their syntax.\n\n#### --done\n\nTerminate with error if there is no done command at the end of the stream. This option\nmight be useful for detecting errors that cause the frontend to terminate before it has\nstarted to write a stream.\n\n#### Locations of Marks Files\n\n--export-marks=<file>\nDumps the internal marks table to <file> when complete. Marks are written one per line as\n:markid SHA-1. Frontends can use this file to validate imports after they have been\ncompleted, or to save the marks table across incremental runs. As <file> is only opened\nand truncated at checkpoint (or completion) the same path can also be safely given to\n--import-marks.\n\n--import-marks=<file>\nBefore processing any input, load the marks specified in <file>. The input file must\nexist, must be readable, and must use the same format as produced by --export-marks.\nMultiple options may be supplied to import more than one set of marks. If a mark is\ndefined to different values, the last file wins.\n\n--import-marks-if-exists=<file>\nLike --import-marks but instead of erroring out, silently skips the file if it does not\nexist.\n\n--[no-]relative-marks\nAfter specifying --relative-marks the paths specified with --import-marks= and\n--export-marks= are relative to an internal directory in the current repository. In\ngit-fast-import this means that the paths are relative to the .git/info/fast-import\ndirectory. However, other importers may use a different location.\n\nRelative and non-relative marks may be combined by interweaving --(no-)-relative-marks\nwith the --(import|export)-marks= options.\n\n#### Submodule Rewriting\n\n--rewrite-submodules-from=<name>:<file>, --rewrite-submodules-to=<name>:<file>\nRewrite the object IDs for the submodule specified by <name> from the values used in the\nfrom <file> to those used in the to <file>. The from marks should have been created by\ngit fast-export, and the to marks should have been created by git fast-import when\nimporting that same submodule.\n\n<name> may be any arbitrary string not containing a colon character, but the same value\nmust be used with both options when specifying corresponding marks. Multiple submodules\nmay be specified with different values for <name>. It is an error not to use these\noptions in corresponding pairs.\n\nThese options are primarily useful when converting a repository from one hash algorithm\nto another; without them, fast-import will fail if it encounters a submodule because it\nhas no way of writing the object ID into the new hash algorithm.\n\n#### Performance and Compression Tuning\n\n--active-branches=<n>\nMaximum number of branches to maintain active at once. See “Memory Utilization” below for\ndetails. Default is 5.\n\n--big-file-threshold=<n>\nMaximum size of a blob that fast-import will attempt to create a delta for, expressed in\nbytes. The default is 512m (512 MiB). Some importers may wish to lower this on systems\nwith constrained memory.\n\n--depth=<n>\nMaximum delta depth, for blob and tree deltification. Default is 50.\n\n--export-pack-edges=<file>\nAfter creating a packfile, print a line of data to <file> listing the filename of the\npackfile and the last commit on each branch that was written to that packfile. This\ninformation may be useful after importing projects whose total object set exceeds the 4\nGiB packfile limit, as these commits can be used as edge points during calls to git\npack-objects.\n\n--max-pack-size=<n>\nMaximum size of each output packfile. The default is unlimited.\n\nfastimport.unpackLimit\nSee git-config(1)\n\n### PERFORMANCE\n\nThe design of fast-import allows it to import large projects in a minimum amount of memory\nusage and processing time. Assuming the frontend is able to keep up with fast-import and feed\nit a constant stream of data, import times for projects holding 10+ years of history and\ncontaining 100,000+ individual commits are generally completed in just 1-2 hours on quite\nmodest (~$2,000 USD) hardware.\n\nMost bottlenecks appear to be in foreign source data access (the source just cannot extract\nrevisions fast enough) or disk IO (fast-import writes as fast as the disk will take the\ndata). Imports will run faster if the source data is stored on a different drive than the\ndestination Git repository (due to less IO contention).\n\n### DEVELOPMENT COST\n\nA typical frontend for fast-import tends to weigh in at approximately 200 lines of\nPerl/Python/Ruby code. Most developers have been able to create working importers in just a\ncouple of hours, even though it is their first exposure to fast-import, and sometimes even to\nGit. This is an ideal situation, given that most conversion tools are throw-away (use once,\nand never look back).\n\n### PARALLEL OPERATION\n\nLike git push or git fetch, imports handled by fast-import are safe to run alongside parallel\ngit repack -a -d or git gc invocations, or any other Git operation (including git prune, as\nloose objects are never used by fast-import).\n\nfast-import does not lock the branch or tag refs it is actively importing. After the import,\nduring its ref update phase, fast-import tests each existing branch ref to verify the update\nwill be a fast-forward update (the commit stored in the ref is contained in the new history\nof the commit to be written). If the update is not a fast-forward update, fast-import will\nskip updating that ref and instead prints a warning message. fast-import will always attempt\nto update all branch refs, and does not stop on the first failure.\n\nBranch updates can be forced with --force, but it’s recommended that this only be used on an\notherwise quiet repository. Using --force is not necessary for an initial import into an\nempty repository.\n\n### TECHNICAL DISCUSSION\n\nfast-import tracks a set of branches in memory. Any branch can be created or modified at any\npoint during the import process by sending a commit command on the input stream. This design\nallows a frontend program to process an unlimited number of branches simultaneously,\ngenerating commits in the order they are available from the source data. It also simplifies\nthe frontend programs considerably.\n\nfast-import does not use or alter the current working directory, or any file within it. (It\ndoes however update the current Git repository, as referenced by GITDIR.) Therefore an\nimport frontend may use the working directory for its own purposes, such as extracting file\nrevisions from the foreign source. This ignorance of the working directory also allows\nfast-import to run very quickly, as it does not need to perform any costly file update\noperations when switching between branches.\n\n### INPUT FORMAT\n\nWith the exception of raw file data (which Git does not interpret) the fast-import input\nformat is text (ASCII) based. This text based format simplifies development and debugging of\nfrontend programs, especially when a higher level language such as Perl, Python or Ruby is\nbeing used.\n\nfast-import is very strict about its input. Where we say SP below we mean exactly one space.\nLikewise LF means one (and only one) linefeed and HT one (and only one) horizontal tab.\nSupplying additional whitespace characters will cause unexpected results, such as branch\nnames or file names with leading or trailing spaces in their name, or early termination of\nfast-import when it encounters unexpected input.\n\n#### Stream Comments\n\nTo aid in debugging frontends fast-import ignores any line that begins with # (ASCII\npound/hash) up to and including the line ending LF. A comment line may contain any sequence\nof bytes that does not contain an LF and therefore may be used to include any detailed\ndebugging information that might be specific to the frontend and useful when inspecting a\nfast-import data stream.\n\n#### Date Formats\n\nThe following date formats are supported. A frontend should select the format it will use for\nthis import by passing the format name in the --date-format=<fmt> command-line option.\n\n#### raw\n\nThis is the Git native format and is <time> SP <offutc>. It is also fast-import’s default\nformat, if --date-format was not specified.\n\nThe time of the event is specified by <time> as the number of seconds since the UNIX\nepoch (midnight, Jan 1, 1970, UTC) and is written as an ASCII decimal integer.\n\nThe local offset is specified by <offutc> as a positive or negative offset from UTC. For\nexample EST (which is 5 hours behind UTC) would be expressed in <tz> by “-0500” while UTC\nis “+0000”. The local offset does not affect <time>; it is used only as an advisement to\nhelp formatting routines display the timestamp.\n\nIf the local offset is not available in the source material, use “+0000”, or the most\ncommon local offset. For example many organizations have a CVS repository which has only\never been accessed by users who are located in the same location and time zone. In this\ncase a reasonable offset from UTC could be assumed.\n\nUnlike the rfc2822 format, this format is very strict. Any variation in formatting will\ncause fast-import to reject the value, and some sanity checks on the numeric values may\nalso be performed.\n\n#### raw-permissive\n\nThis is the same as raw except that no sanity checks on the numeric epoch and local\noffset are performed. This can be useful when trying to filter or import an existing\nhistory with e.g. bogus timezone values.\n\n#### rfc2822\n\nThis is the standard email format as described by RFC 2822.\n\nAn example value is “Tue Feb 6 11:22:18 2007 -0500”. The Git parser is accurate, but a\nlittle on the lenient side. It is the same parser used by git am when applying patches\nreceived from email.\n\nSome malformed strings may be accepted as valid dates. In some of these cases Git will\nstill be able to obtain the correct date from the malformed string. There are also some\ntypes of malformed strings which Git will parse wrong, and yet consider valid. Seriously\nmalformed strings will be rejected.\n\nUnlike the raw format above, the time zone/UTC offset information contained in an RFC\n2822 date string is used to adjust the date value to UTC prior to storage. Therefore it\nis important that this information be as accurate as possible.\n\nIf the source material uses RFC 2822 style dates, the frontend should let fast-import\nhandle the parsing and conversion (rather than attempting to do it itself) as the Git\nparser has been well tested in the wild.\n\nFrontends should prefer the raw format if the source material already uses UNIX-epoch\nformat, can be coaxed to give dates in that format, or its format is easily convertible\nto it, as there is no ambiguity in parsing.\n\n#### now\n\nAlways use the current time and time zone. The literal now must always be supplied for\n<when>.\n\nThis is a toy format. The current time and time zone of this system is always copied into\nthe identity string at the time it is being created by fast-import. There is no way to\nspecify a different time or time zone.\n\nThis particular format is supplied as it’s short to implement and may be useful to a\nprocess that wants to create a new commit right now, without needing to use a working\ndirectory or git update-index.\n\nIf separate author and committer commands are used in a commit the timestamps may not\nmatch, as the system clock will be polled twice (once for each command). The only way to\nensure that both author and committer identity information has the same timestamp is to\nomit author (thus copying from committer) or to use a date format other than now.\n\n#### Commands\n\nfast-import accepts several commands to update the current repository and control the current\nimport process. More detailed discussion (with examples) of each command follows later.\n\n#### commit\n\nCreates a new branch or updates an existing branch by creating a new commit and updating\nthe branch to point at the newly created commit.\n\n#### tag\n\nCreates an annotated tag object from an existing commit or branch. Lightweight tags are\nnot supported by this command, as they are not recommended for recording meaningful\npoints in time.\n\n#### reset\n\nReset an existing branch (or a new branch) to a specific revision. This command must be\nused to change a branch to a specific revision without making a commit on it.\n\n#### blob\n\nConvert raw file data into a blob, for future use in a commit command. This command is\noptional and is not needed to perform an import.\n\n#### alias\n\nRecord that a mark refers to a given object without first creating any new object. Using\n--import-marks and referring to missing marks will cause fast-import to fail, so aliases\ncan provide a way to set otherwise pruned commits to a valid value (e.g. the nearest\nnon-pruned ancestor).\n\n#### checkpoint\n\nForces fast-import to close the current packfile, generate its unique SHA-1 checksum and\nindex, and start a new packfile. This command is optional and is not needed to perform an\nimport.\n\n#### progress\n\nCauses fast-import to echo the entire line to its own standard output. This command is\noptional and is not needed to perform an import.\n\n#### done\n\nMarks the end of the stream. This command is optional unless the done feature was\nrequested using the --done command-line option or feature done command.\n\n#### get-mark\n\nCauses fast-import to print the SHA-1 corresponding to a mark to the file descriptor set\nwith --cat-blob-fd, or stdout if unspecified.\n\n#### cat-blob\n\nCauses fast-import to print a blob in cat-file --batch format to the file descriptor set\nwith --cat-blob-fd or stdout if unspecified.\n\nls\nCauses fast-import to print a line describing a directory entry in ls-tree format to the\nfile descriptor set with --cat-blob-fd or stdout if unspecified.\n\n#### feature\n\nEnable the specified feature. This requires that fast-import supports the specified\nfeature, and aborts if it does not.\n\n#### option\n\nSpecify any of the options listed under OPTIONS that do not change stream semantic to\nsuit the frontend’s needs. This command is optional and is not needed to perform an\nimport.\n\n#### commit\n\nCreate or update a branch with a new commit, recording one logical change to the project.\n\n'commit' SP <ref> LF\nmark?\noriginal-oid?\n('author' (SP <name>)? SP LT <email> GT SP <when> LF)?\n'committer' (SP <name>)? SP LT <email> GT SP <when> LF\n('encoding' SP <encoding>)?\ndata\n('from' SP <commit-ish> LF)?\n('merge' SP <commit-ish> LF)*\n(filemodify | filedelete | filecopy | filerename | filedeleteall | notemodify)*\nLF?\n\nwhere <ref> is the name of the branch to make the commit on. Typically branch names are\nprefixed with refs/heads/ in Git, so importing the CVS branch symbol RELENG-10 would use\nrefs/heads/RELENG-10 for the value of <ref>. The value of <ref> must be a valid refname in\nGit. As LF is not valid in a Git refname, no quoting or escaping syntax is supported here.\n\nA mark command may optionally appear, requesting fast-import to save a reference to the newly\ncreated commit for future use by the frontend (see below for format). It is very common for\nfrontends to mark every commit they create, thereby allowing future branch creation from any\nimported commit.\n\nThe data command following committer must supply the commit message (see below for data\ncommand syntax). To import an empty commit message use a 0 length data. Commit messages are\nfree-form and are not interpreted by Git. Currently they must be encoded in UTF-8, as\nfast-import does not permit other encodings to be specified.\n\nZero or more filemodify, filedelete, filecopy, filerename, filedeleteall and notemodify\ncommands may be included to update the contents of the branch prior to creating the commit.\nThese commands may be supplied in any order. However it is recommended that a filedeleteall\ncommand precede all filemodify, filecopy, filerename and notemodify commands in the same\ncommit, as filedeleteall wipes the branch clean (see below).\n\nThe LF after the command is optional (it used to be required). Note that for reasons of\nbackward compatibility, if the commit ends with a data command (i.e. it has no from, merge,\nfilemodify, filedelete, filecopy, filerename, filedeleteall or notemodify commands) then two\nLF commands may appear at the end of the command instead of just one.\n\n#### author\n\nAn author command may optionally appear, if the author information might differ from the\ncommitter information. If author is omitted then fast-import will automatically use the\ncommitter’s information for the author portion of the commit. See below for a description\nof the fields in author, as they are identical to committer.\n\n#### committer\n\nThe committer command indicates who made this commit, and when they made it.\n\nHere <name> is the person’s display name (for example “Com M Itter”) and <email> is the\nperson’s email address (“cm@example.com”). LT and GT are the literal less-than (\\x3c) and\ngreater-than (\\x3e) symbols. These are required to delimit the email address from the\nother fields in the line. Note that <name> and <email> are free-form and may contain any\nsequence of bytes, except LT, GT and LF. <name> is typically UTF-8 encoded.\n\nThe time of the change is specified by <when> using the date format that was selected by\nthe --date-format=<fmt> command-line option. See “Date Formats” above for the set of\nsupported formats, and their syntax.\n\n#### encoding\n\nThe optional encoding command indicates the encoding of the commit message. Most commits\nare UTF-8 and the encoding is omitted, but this allows importing commit messages into git\nwithout first reencoding them.\n\n#### from\n\nThe from command is used to specify the commit to initialize this branch from. This\nrevision will be the first ancestor of the new commit. The state of the tree built at\nthis commit will begin with the state at the from commit, and be altered by the content\nmodifications in this commit.\n\nOmitting the from command in the first commit of a new branch will cause fast-import to\ncreate that commit with no ancestor. This tends to be desired only for the initial commit\nof a project. If the frontend creates all files from scratch when making a new branch, a\nmerge command may be used instead of from to start the commit with an empty tree.\nOmitting the from command on existing branches is usually desired, as the current commit\non that branch is automatically assumed to be the first ancestor of the new commit.\n\nAs LF is not valid in a Git refname or SHA-1 expression, no quoting or escaping syntax is\nsupported within <commit-ish>.\n\nHere <commit-ish> is any of the following:\n\n•   The name of an existing branch already in fast-import’s internal branch table. If\nfast-import doesn’t know the name, it’s treated as a SHA-1 expression.\n\n•   A mark reference, :<idnum>, where <idnum> is the mark number.\n\nThe reason fast-import uses : to denote a mark reference is this character is not\nlegal in a Git branch name. The leading : makes it easy to distinguish between the\nmark 42 (:42) and the branch 42 (42 or refs/heads/42), or an abbreviated SHA-1 which\nhappened to consist only of base-10 digits.\n\nMarks must be declared (via mark) before they can be used.\n\n•   A complete 40 byte or abbreviated commit SHA-1 in hex.\n\n•   Any valid Git SHA-1 expression that resolves to a commit. See “SPECIFYING REVISIONS”\nin gitrevisions(7) for details.\n\n•   The special null SHA-1 (40 zeros) specifies that the branch is to be removed.\n\nThe special case of restarting an incremental import from the current branch value should\nbe written as:\n\nfrom refs/heads/branch^0\n\n\nThe ^0 suffix is necessary as fast-import does not permit a branch to start from itself,\nand the branch is created in memory before the from command is even read from the input.\nAdding ^0 will force fast-import to resolve the commit through Git’s revision parsing\nlibrary, rather than its internal branch table, thereby loading in the existing value of\nthe branch.\n\n#### merge\n\nIncludes one additional ancestor commit. The additional ancestry link does not change the\nway the tree state is built at this commit. If the from command is omitted when creating\na new branch, the first merge commit will be the first ancestor of the current commit,\nand the branch will start out with no files. An unlimited number of merge commands per\ncommit are permitted by fast-import, thereby establishing an n-way merge.\n\nHere <commit-ish> is any of the commit specification expressions also accepted by from\n(see above).\n\n#### filemodify\n\nIncluded in a commit command to add a new file or change the content of an existing file.\nThis command has two different means of specifying the content of the file.\n\nExternal data format\nThe data content for the file was already supplied by a prior blob command. The\nfrontend just needs to connect it.\n\n'M' SP <mode> SP <dataref> SP <path> LF\n\nHere usually <dataref> must be either a mark reference (:<idnum>) set by a prior blob\ncommand, or a full 40-byte SHA-1 of an existing Git blob object. If <mode> is 040000`\nthen <dataref> must be the full 40-byte SHA-1 of an existing Git tree object or a\nmark reference set with --import-marks.\n\nInline data format\nThe data content for the file has not been supplied yet. The frontend wants to supply\nit as part of this modify command.\n\n'M' SP <mode> SP 'inline' SP <path> LF\ndata\n\nSee below for a detailed description of the data command.\n\nIn both formats <mode> is the type of file entry, specified in octal. Git only supports\nthe following modes:\n\n•   100644 or 644: A normal (not-executable) file. The majority of files in most projects\nuse this mode. If in doubt, this is what you want.\n\n•   100755 or 755: A normal, but executable, file.\n\n•   120000: A symlink, the content of the file will be the link target.\n\n•   160000: A gitlink, SHA-1 of the object refers to a commit in another repository. Git\nlinks can only be specified by SHA or through a commit mark. They are used to\nimplement submodules.\n\n•   040000: A subdirectory. Subdirectories can only be specified by SHA or through a tree\nmark set with --import-marks.\n\nIn both formats <path> is the complete path of the file to be added (if not already\nexisting) or modified (if already existing).\n\nA <path> string must use UNIX-style directory separators (forward slash /), may contain\nany byte other than LF, and must not start with double quote (\").\n\nA path can use C-style string quoting; this is accepted in all cases and mandatory if the\nfilename starts with double quote or contains LF. In C-style quoting, the complete name\nshould be surrounded with double quotes, and any LF, backslash, or double quote\ncharacters must be escaped by preceding them with a backslash (e.g., \"path/with\\n, \\\\ and\n\\\" in it\").\n\nThe value of <path> must be in canonical form. That is it must not:\n\n•   contain an empty directory component (e.g.  foo//bar is invalid),\n\n•   end with a directory separator (e.g.  foo/ is invalid),\n\n•   start with a directory separator (e.g.  /foo is invalid),\n\n•   contain the special component .  or ..  (e.g.  foo/./bar and foo/../bar are invalid).\n\nThe root of the tree can be represented by an empty string as <path>.\n\nIt is recommended that <path> always be encoded using UTF-8.\n\n#### filedelete\n\nIncluded in a commit command to remove a file or recursively delete an entire directory\nfrom the branch. If the file or directory removal makes its parent directory empty, the\nparent directory will be automatically removed too. This cascades up the tree until the\nfirst non-empty directory or the root is reached.\n\n'D' SP <path> LF\n\nhere <path> is the complete path of the file or subdirectory to be removed from the\nbranch. See filemodify above for a detailed description of <path>.\n\n#### filecopy\n\nRecursively copies an existing file or subdirectory to a different location within the\nbranch. The existing file or directory must exist. If the destination exists it will be\ncompletely replaced by the content copied from the source.\n\n'C' SP <path> SP <path> LF\n\nhere the first <path> is the source location and the second <path> is the destination.\nSee filemodify above for a detailed description of what <path> may look like. To use a\nsource path that contains SP the path must be quoted.\n\nA filecopy command takes effect immediately. Once the source location has been copied to\nthe destination any future commands applied to the source location will not impact the\ndestination of the copy.\n\n#### filerename\n\nRenames an existing file or subdirectory to a different location within the branch. The\nexisting file or directory must exist. If the destination exists it will be replaced by\nthe source directory.\n\n'R' SP <path> SP <path> LF\n\nhere the first <path> is the source location and the second <path> is the destination.\nSee filemodify above for a detailed description of what <path> may look like. To use a\nsource path that contains SP the path must be quoted.\n\nA filerename command takes effect immediately. Once the source location has been renamed\nto the destination any future commands applied to the source location will create new\nfiles there and not impact the destination of the rename.\n\nNote that a filerename is the same as a filecopy followed by a filedelete of the source\nlocation. There is a slight performance advantage to using filerename, but the advantage\nis so small that it is never worth trying to convert a delete/add pair in source material\ninto a rename for fast-import. This filerename command is provided just to simplify\nfrontends that already have rename information and don’t want bother with decomposing it\ninto a filecopy followed by a filedelete.\n\n#### filedeleteall\n\nIncluded in a commit command to remove all files (and also all directories) from the\nbranch. This command resets the internal branch structure to have no files in it,\nallowing the frontend to subsequently add all interesting files from scratch.\n\n'deleteall' LF\n\nThis command is extremely useful if the frontend does not know (or does not care to know)\nwhat files are currently on the branch, and therefore cannot generate the proper\nfiledelete commands to update the content.\n\nIssuing a filedeleteall followed by the needed filemodify commands to set the correct\ncontent will produce the same results as sending only the needed filemodify and\nfiledelete commands. The filedeleteall approach may however require fast-import to use\nslightly more memory per active branch (less than 1 MiB for even most large projects); so\nfrontends that can easily obtain only the affected paths for a commit are encouraged to\ndo so.\n\n#### notemodify\n\nIncluded in a commit <notesref> command to add a new note annotating a <commit-ish> or\nchange this annotation contents. Internally it is similar to filemodify 100644 on\n<commit-ish> path (maybe split into subdirectories). It’s not advised to use any other\ncommands to write to the <notesref> tree except filedeleteall to delete all existing\nnotes in this tree. This command has two different means of specifying the content of the\nnote.\n\nExternal data format\nThe data content for the note was already supplied by a prior blob command. The\nfrontend just needs to connect it to the commit that is to be annotated.\n\n'N' SP <dataref> SP <commit-ish> LF\n\nHere <dataref> can be either a mark reference (:<idnum>) set by a prior blob command,\nor a full 40-byte SHA-1 of an existing Git blob object.\n\nInline data format\nThe data content for the note has not been supplied yet. The frontend wants to supply\nit as part of this modify command.\n\n'N' SP 'inline' SP <commit-ish> LF\ndata\n\nSee below for a detailed description of the data command.\n\nIn both formats <commit-ish> is any of the commit specification expressions also accepted\nby from (see above).\n\n#### mark\n\nArranges for fast-import to save a reference to the current object, allowing the frontend to\nrecall this object at a future point in time, without knowing its SHA-1. Here the current\nobject is the object creation command the mark command appears within. This can be commit,\ntag, and blob, but commit is the most common usage.\n\n'mark' SP ':' <idnum> LF\n\nwhere <idnum> is the number assigned by the frontend to this mark. The value of <idnum> is\nexpressed as an ASCII decimal integer. The value 0 is reserved and cannot be used as a mark.\nOnly values greater than or equal to 1 may be used as marks.\n\nNew marks are created automatically. Existing marks can be moved to another object simply by\nreusing the same <idnum> in another mark command.\n\n#### original-oid\n\nProvides the name of the object in the original source control system. fast-import will\nsimply ignore this directive, but filter processes which operate on and modify the stream\nbefore feeding to fast-import may have uses for this information\n\n'original-oid' SP <object-identifier> LF\n\nwhere <object-identifier> is any string not containing LF.\n\n#### tag\n\nCreates an annotated tag referring to a specific commit. To create lightweight\n(non-annotated) tags see the reset command below.\n\n'tag' SP <name> LF\nmark?\n'from' SP <commit-ish> LF\noriginal-oid?\n'tagger' (SP <name>)? SP LT <email> GT SP <when> LF\ndata\n\nwhere <name> is the name of the tag to create.\n\nTag names are automatically prefixed with refs/tags/ when stored in Git, so importing the CVS\nbranch symbol RELENG-10-FINAL would use just RELENG-10-FINAL for <name>, and fast-import\nwill write the corresponding ref as refs/tags/RELENG-10-FINAL.\n\nThe value of <name> must be a valid refname in Git and therefore may contain forward slashes.\nAs LF is not valid in a Git refname, no quoting or escaping syntax is supported here.\n\nThe from command is the same as in the commit command; see above for details.\n\nThe tagger command uses the same format as committer within commit; again see above for\ndetails.\n\nThe data command following tagger must supply the annotated tag message (see below for data\ncommand syntax). To import an empty tag message use a 0 length data. Tag messages are\nfree-form and are not interpreted by Git. Currently they must be encoded in UTF-8, as\nfast-import does not permit other encodings to be specified.\n\nSigning annotated tags during import from within fast-import is not supported. Trying to\ninclude your own PGP/GPG signature is not recommended, as the frontend does not (easily) have\naccess to the complete set of bytes which normally goes into such a signature. If signing is\nrequired, create lightweight tags from within fast-import with reset, then create the\nannotated versions of those tags offline with the standard git tag process.\n\n#### reset\n\nCreates (or recreates) the named branch, optionally starting from a specific revision. The\nreset command allows a frontend to issue a new from command for an existing branch, or to\ncreate a new branch from an existing commit without creating a new commit.\n\n'reset' SP <ref> LF\n('from' SP <commit-ish> LF)?\nLF?\n\nFor a detailed description of <ref> and <commit-ish> see above under commit and from.\n\nThe LF after the command is optional (it used to be required).\n\nThe reset command can also be used to create lightweight (non-annotated) tags. For example:\n\nreset refs/tags/938\nfrom :938\n\nwould create the lightweight tag refs/tags/938 referring to whatever commit mark :938\nreferences.\n\n#### blob\n\nRequests writing one file revision to the packfile. The revision is not connected to any\ncommit; this connection must be formed in a subsequent commit command by referencing the blob\nthrough an assigned mark.\n\n'blob' LF\nmark?\noriginal-oid?\ndata\n\nThe mark command is optional here as some frontends have chosen to generate the Git SHA-1 for\nthe blob on their own, and feed that directly to commit. This is typically more work than\nit’s worth however, as marks are inexpensive to store and easy to use.\n\n#### data\n\nSupplies raw data (for use as blob/file content, commit messages, or annotated tag messages)\nto fast-import. Data can be supplied using an exact byte count or delimited with a\nterminating line. Real frontends intended for production-quality conversions should always\nuse the exact byte count format, as it is more robust and performs better. The delimited\nformat is intended primarily for testing fast-import.\n\nComment lines appearing within the <raw> part of data commands are always taken to be part of\nthe body of the data and are therefore never ignored by fast-import. This makes it safe to\nimport any file/message content whose lines might start with #.\n\nExact byte count format\nThe frontend must specify the number of bytes of data.\n\n'data' SP <count> LF\n<raw> LF?\n\nwhere <count> is the exact number of bytes appearing within <raw>. The value of <count>\nis expressed as an ASCII decimal integer. The LF on either side of <raw> is not included\nin <count> and will not be included in the imported data.\n\nThe LF after <raw> is optional (it used to be required) but recommended. Always including\nit makes debugging a fast-import stream easier as the next command always starts in\ncolumn 0 of the next line, even if <raw> did not end with an LF.\n\nDelimited format\nA delimiter string is used to mark the end of the data. fast-import will compute the\nlength by searching for the delimiter. This format is primarily useful for testing and is\nnot recommended for real data.\n\n'data' SP '<<' <delim> LF\n<raw> LF\n<delim> LF\nLF?\n\nwhere <delim> is the chosen delimiter string. The string <delim> must not appear on a\nline by itself within <raw>, as otherwise fast-import will think the data ends earlier\nthan it really does. The LF immediately trailing <raw> is part of <raw>. This is one of\nthe limitations of the delimited format, it is impossible to supply a data chunk which\ndoes not have an LF as its last byte.\n\nThe LF after <delim> LF is optional (it used to be required).\n\n#### alias\n\nRecord that a mark refers to a given object without first creating any new object.\n\n'alias' LF\nmark\n'to' SP <commit-ish> LF\nLF?\n\nFor a detailed description of <commit-ish> see above under from.\n\n#### checkpoint\n\nForces fast-import to close the current packfile, start a new one, and to save out all\ncurrent branch refs, tags and marks.\n\n'checkpoint' LF\nLF?\n\nNote that fast-import automatically switches packfiles when the current packfile reaches\n--max-pack-size, or 4 GiB, whichever limit is smaller. During an automatic packfile switch\nfast-import does not update the branch refs, tags or marks.\n\nAs a checkpoint can require a significant amount of CPU time and disk IO (to compute the\noverall pack SHA-1 checksum, generate the corresponding index file, and update the refs) it\ncan easily take several minutes for a single checkpoint command to complete.\n\nFrontends may choose to issue checkpoints during extremely large and long running imports, or\nwhen they need to allow another Git process access to a branch. However given that a 30 GiB\nSubversion repository can be loaded into Git through fast-import in about 3 hours, explicit\ncheckpointing may not be necessary.\n\nThe LF after the command is optional (it used to be required).\n\n#### progress\n\nCauses fast-import to print the entire progress line unmodified to its standard output\nchannel (file descriptor 1) when the command is processed from the input stream. The command\notherwise has no impact on the current import, or on any of fast-import’s internal state.\n\n'progress' SP <any> LF\nLF?\n\nThe <any> part of the command may contain any sequence of bytes that does not contain LF. The\nLF after the command is optional. Callers may wish to process the output through a tool such\nas sed to remove the leading part of the line, for example:\n\nfrontend | git fast-import | sed 's/^progress //'\n\nPlacing a progress command immediately after a checkpoint will inform the reader when the\ncheckpoint has been completed and it can safely access the refs that fast-import updated.\n\n#### get-mark\n\nCauses fast-import to print the SHA-1 corresponding to a mark to stdout or to the file\ndescriptor previously arranged with the --cat-blob-fd argument. The command otherwise has no\nimpact on the current import; its purpose is to retrieve SHA-1s that later commits might want\nto refer to in their commit messages.\n\n'get-mark' SP ':' <idnum> LF\n\nSee “Responses To Commands” below for details about how to read this output safely.\n\n#### cat-blob\n\nCauses fast-import to print a blob to a file descriptor previously arranged with the\n--cat-blob-fd argument. The command otherwise has no impact on the current import; its main\npurpose is to retrieve blobs that may be in fast-import’s memory but not accessible from the\ntarget repository.\n\n'cat-blob' SP <dataref> LF\n\nThe <dataref> can be either a mark reference (:<idnum>) set previously or a full 40-byte\nSHA-1 of a Git blob, preexisting or ready to be written.\n\nOutput uses the same format as git cat-file --batch:\n\n<sha1> SP 'blob' SP <size> LF\n<contents> LF\n\nThis command can be used where a filemodify directive can appear, allowing it to be used in\nthe middle of a commit. For a filemodify using an inline directive, it can also appear right\nbefore the data directive.\n\nSee “Responses To Commands” below for details about how to read this output safely.\n\nls\nPrints information about the object at a path to a file descriptor previously arranged with\nthe --cat-blob-fd argument. This allows printing a blob from the active commit (with\ncat-blob) or copying a blob or tree from a previous commit for use in the current one (with\nfilemodify).\n\nThe ls command can also be used where a filemodify directive can appear, allowing it to be\nused in the middle of a commit.\n\nReading from the active commit\nThis form can only be used in the middle of a commit. The path names a directory entry\nwithin fast-import’s active commit. The path must be quoted in this case.\n\n'ls' SP <path> LF\n\nReading from a named tree\nThe <dataref> can be a mark reference (:<idnum>) or the full 40-byte SHA-1 of a Git tag,\ncommit, or tree object, preexisting or waiting to be written. The path is relative to the\ntop level of the tree named by <dataref>.\n\n'ls' SP <dataref> SP <path> LF\n\nSee filemodify above for a detailed description of <path>.\n\nOutput uses the same format as git ls-tree <tree> -- <path>:\n\n<mode> SP ('blob' | 'tree' | 'commit') SP <dataref> HT <path> LF\n\nThe <dataref> represents the blob, tree, or commit object at <path> and can be used in later\nget-mark, cat-blob, filemodify, or ls commands.\n\nIf there is no file or subtree at that path, git fast-import will instead report\n\nmissing SP <path> LF\n\nSee “Responses To Commands” below for details about how to read this output safely.\n\n#### feature\n\nRequire that fast-import supports the specified feature, or abort if it does not.\n\n'feature' SP <feature> ('=' <argument>)? LF\n\nThe <feature> part of the command may be any one of the following:\n\ndate-format, export-marks, relative-marks, no-relative-marks, force\nAct as though the corresponding command-line option with a leading -- was passed on the\ncommand line (see OPTIONS, above).\n\nimport-marks, import-marks-if-exists\nLike --import-marks except in two respects: first, only one \"feature import-marks\" or\n\"feature import-marks-if-exists\" command is allowed per stream; second, an\n--import-marks= or --import-marks-if-exists command-line option overrides any of these\n\"feature\" commands in the stream; third, \"feature import-marks-if-exists\" like a\ncorresponding command-line option silently skips a nonexistent file.\n\nget-mark, cat-blob, ls\nRequire that the backend support the get-mark, cat-blob, or ls command respectively.\nVersions of fast-import not supporting the specified command will exit with a message\nindicating so. This lets the import error out early with a clear message, rather than\nwasting time on the early part of an import before the unsupported command is detected.\n\nnotes\nRequire that the backend support the notemodify (N) subcommand to the commit command.\nVersions of fast-import not supporting notes will exit with a message indicating so.\n\ndone\nError out if the stream ends without a done command. Without this feature, errors causing\nthe frontend to end abruptly at a convenient point in the stream can go undetected. This\nmay occur, for example, if an import front end dies in mid-operation without emitting\nSIGTERM or SIGKILL at its subordinate git fast-import instance.\n\n#### option\n\nProcesses the specified option so that git fast-import behaves in a way that suits the\nfrontend’s needs. Note that options specified by the frontend are overridden by any options\nthe user may specify to git fast-import itself.\n\n'option' SP <option> LF\n\nThe <option> part of the command may contain any of the options listed in the OPTIONS section\nthat do not change import semantics, without the leading -- and is treated in the same way.\n\nOption commands must be the first commands on the input (not counting feature commands), to\ngive an option command after any non-option command is an error.\n\nThe following command-line options change import semantics and may therefore not be passed as\noption:\n\n•   date-format\n\n•   import-marks\n\n•   export-marks\n\n•   cat-blob-fd\n\n•   force\n\n#### done\n\nIf the done feature is not in use, treated as if EOF was read. This can be used to tell\nfast-import to finish early.\n\nIf the --done command-line option or feature done command is in use, the done command is\nmandatory and marks the end of the stream.\n\n### RESPONSES TO COMMANDS\n\nNew objects written by fast-import are not available immediately. Most fast-import commands\nhave no visible effect until the next checkpoint (or completion). The frontend can send\ncommands to fill fast-import’s input pipe without worrying about how quickly they will take\neffect, which improves performance by simplifying scheduling.\n\nFor some frontends, though, it is useful to be able to read back data from the current\nrepository as it is being updated (for example when the source material describes objects in\nterms of patches to be applied to previously imported objects). This can be accomplished by\nconnecting the frontend and fast-import via bidirectional pipes:\n\nmkfifo fast-import-output\nfrontend <fast-import-output |\ngit fast-import >fast-import-output\n\nA frontend set up this way can use progress, get-mark, ls, and cat-blob commands to read\ninformation from the import in progress.\n\nTo avoid deadlock, such frontends must completely consume any pending output from progress,\nls, get-mark, and cat-blob before performing writes to fast-import that might block.\n\n### CRASH REPORTS\n\nIf fast-import is supplied invalid input it will terminate with a non-zero exit status and\ncreate a crash report in the top level of the Git repository it was importing into. Crash\nreports contain a snapshot of the internal fast-import state as well as the most recent\ncommands that lead up to the crash.\n\nAll recent commands (including stream comments, file changes and progress commands) are shown\nin the command history within the crash report, but raw file data and commit messages are\nexcluded from the crash report. This exclusion saves space within the report file and reduces\nthe amount of buffering that fast-import must perform during execution.\n\nAfter writing a crash report fast-import will close the current packfile and export the marks\ntable. This allows the frontend developer to inspect the repository state and resume the\nimport from the point where it crashed. The modified branches and tags are not updated during\na crash, as the import did not complete successfully. Branch and tag information can be found\nin the crash report and must be applied manually if the update is needed.\n\nAn example crash:\n\n$ cat >in <<ENDOFINPUT\n# my very first test commit\ncommit refs/heads/master\ncommitter Shawn O. Pearce <spearce> 19283 -0400\n# who is that guy anyway?\ndata <<EOF\nthis is my commit\nEOF\nM 644 inline .gitignore\ndata <<EOF\n.gitignore\nEOF\nM 777 inline bob\nENDOFINPUT\n\n$ git fast-import <in\nfatal: Corrupt mode: M 777 inline bob\nfast-import: dumping crash report to .git/fastimportcrash8434\n\n$ cat .git/fastimportcrash8434\nfast-import crash report:\nfast-import process: 8434\nparent process     : 1391\nat Sat Sep 1 00:58:12 2007\n\nfatal: Corrupt mode: M 777 inline bob\n\nMost Recent Commands Before Crash\n---------------------------------\n# my very first test commit\ncommit refs/heads/master\ncommitter Shawn O. Pearce <spearce> 19283 -0400\n# who is that guy anyway?\ndata <<EOF\nM 644 inline .gitignore\ndata <<EOF\n* M 777 inline bob\n\nActive Branch LRU\n-----------------\nactivebranches = 1 cur, 5 max\n\npos  clock name\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n1)      0 refs/heads/master\n\nInactive Branches\n-----------------\nrefs/heads/master:\nstatus      : active loaded dirty\ntip commit  : 0000000000000000000000000000000000000000\nold tree    : 0000000000000000000000000000000000000000\ncur tree    : 0000000000000000000000000000000000000000\ncommit clock: 0\nlast pack   :\n\n-------------------\nEND OF CRASH REPORT\n\n### TIPS AND TRICKS\n\nThe following tips and tricks have been collected from various users of fast-import, and are\noffered here as suggestions.\n\n#### Use One Mark Per Commit\n\nWhen doing a repository conversion, use a unique mark per commit (mark :<n>) and supply the\n--export-marks option on the command line. fast-import will dump a file which lists every\nmark and the Git object SHA-1 that corresponds to it. If the frontend can tie the marks back\nto the source repository, it is easy to verify the accuracy and completeness of the import by\ncomparing each Git commit to the corresponding source revision.\n\nComing from a system such as Perforce or Subversion this should be quite simple, as the\nfast-import mark can also be the Perforce changeset number or the Subversion revision number.\n\n#### Freely Skip Around Branches\n\nDon’t bother trying to optimize the frontend to stick to one branch at a time during an\nimport. Although doing so might be slightly faster for fast-import, it tends to increase the\ncomplexity of the frontend code considerably.\n\nThe branch LRU builtin to fast-import tends to behave very well, and the cost of activating\nan inactive branch is so low that bouncing around between branches has virtually no impact on\nimport performance.\n\n#### Handling Renames\n\nWhen importing a renamed file or directory, simply delete the old name(s) and modify the new\nname(s) during the corresponding commit. Git performs rename detection after-the-fact, rather\nthan explicitly during a commit.\n\n#### Use Tag Fixup Branches\n\nSome other SCM systems let the user create a tag from multiple files which are not from the\nsame commit/changeset. Or to create tags which are a subset of the files available in the\nrepository.\n\nImporting these tags as-is in Git is impossible without making at least one commit which\n“fixes up” the files to match the content of the tag. Use fast-import’s reset command to\nreset a dummy branch outside of your normal branch space to the base commit for the tag, then\ncommit one or more file fixup commits, and finally tag the dummy branch.\n\nFor example since all normal branches are stored under refs/heads/ name the tag fixup branch\nTAGFIXUP. This way it is impossible for the fixup branch used by the importer to have\nnamespace conflicts with real branches imported from the source (the name TAGFIXUP is not\nrefs/heads/TAGFIXUP).\n\nWhen committing fixups, consider using merge to connect the commit(s) which are supplying\nfile revisions to the fixup branch. Doing so will allow tools such as git blame to track\nthrough the real commit history and properly annotate the source files.\n\nAfter fast-import terminates the frontend will need to do rm .git/TAGFIXUP to remove the\ndummy branch.\n\n#### Import Now, Repack Later\n\nAs soon as fast-import completes the Git repository is completely valid and ready for use.\nTypically this takes only a very short time, even for considerably large projects (100,000+\ncommits).\n\nHowever repacking the repository is necessary to improve data locality and access\nperformance. It can also take hours on extremely large projects (especially if -f and a large\n--window parameter is used). Since repacking is safe to run alongside readers and writers,\nrun the repack in the background and let it finish when it finishes. There is no reason to\nwait to explore your new Git project!\n\nIf you choose to wait for the repack, don’t try to run benchmarks or performance tests until\nrepacking is completed. fast-import outputs suboptimal packfiles that are simply never seen\nin real use situations.\n\n#### Repacking Historical Data\n\nIf you are repacking very old imported data (e.g. older than the last year), consider\nexpending some extra CPU time and supplying --window=50 (or higher) when you run git repack.\nThis will take longer, but will also produce a smaller packfile. You only need to expend the\neffort once, and everyone using your project will benefit from the smaller repository.\n\n#### Include Some Progress Messages\n\nEvery once in a while have your frontend emit a progress message to fast-import. The contents\nof the messages are entirely free-form, so one suggestion would be to output the current\nmonth and year each time the current commit date moves into the next month. Your users will\nfeel better knowing how much of the data stream has been processed.\n\n### PACKFILE OPTIMIZATION\n\nWhen packing a blob fast-import always attempts to deltify against the last blob written.\nUnless specifically arranged for by the frontend, this will probably not be a prior version\nof the same file, so the generated delta will not be the smallest possible. The resulting\npackfile will be compressed, but will not be optimal.\n\nFrontends which have efficient access to all revisions of a single file (for example reading\nan RCS/CVS ,v file) can choose to supply all revisions of that file as a sequence of\nconsecutive blob commands. This allows fast-import to deltify the different file revisions\nagainst each other, saving space in the final packfile. Marks can be used to later identify\nindividual file revisions during a sequence of commit commands.\n\nThe packfile(s) created by fast-import do not encourage good disk access patterns. This is\ncaused by fast-import writing the data in the order it is received on standard input, while\nGit typically organizes data within packfiles to make the most recent (current tip) data\nappear before historical data. Git also clusters commits together, speeding up revision\ntraversal through better cache locality.\n\nFor this reason it is strongly recommended that users repack the repository with git repack\n\n#### -a -d\n\naccess. If blob deltas are suboptimal (see above) then also adding the -f option to force\nrecomputation of all deltas can significantly reduce the final packfile size (30-50% smaller\ncan be quite typical).\n\nInstead of running git repack you can also run git gc --aggressive, which will also optimize\nother things after an import (e.g. pack loose refs). As noted in the \"AGGRESSIVE\" section in\ngit-gc(1) the --aggressive option will find new deltas with the -f option to git-repack(1).\nFor the reasons elaborated on above using --aggressive after a fast-import is one of the few\ncases where it’s known to be worthwhile.\n\n### MEMORY UTILIZATION\n\nThere are a number of factors which affect how much memory fast-import requires to perform an\nimport. Like critical sections of core Git, fast-import uses its own memory allocators to\namortize any overheads associated with malloc. In practice fast-import tends to amortize any\nmalloc overheads to 0, due to its use of large block allocations.\n\n#### per object\n\nfast-import maintains an in-memory structure for every object written in this execution. On a\n32 bit system the structure is 32 bytes, on a 64 bit system the structure is 40 bytes (due to\nthe larger pointer sizes). Objects in the table are not deallocated until fast-import\nterminates. Importing 2 million objects on a 32 bit system will require approximately 64 MiB\nof memory.\n\nThe object table is actually a hashtable keyed on the object name (the unique SHA-1). This\nstorage configuration allows fast-import to reuse an existing or already written object and\navoid writing duplicates to the output packfile. Duplicate blobs are surprisingly common in\nan import, typically due to branch merges in the source.\n\n#### per mark\n\nMarks are stored in a sparse array, using 1 pointer (4 bytes or 8 bytes, depending on pointer\nsize) per mark. Although the array is sparse, frontends are still strongly encouraged to use\nmarks between 1 and n, where n is the total number of marks required for this import.\n\n#### per branch\n\nBranches are classified as active and inactive. The memory usage of the two classes is\nsignificantly different.\n\nInactive branches are stored in a structure which uses 96 or 120 bytes (32 bit or 64 bit\nsystems, respectively), plus the length of the branch name (typically under 200 bytes), per\nbranch. fast-import will easily handle as many as 10,000 inactive branches in under 2 MiB of\nmemory.\n\nActive branches have the same overhead as inactive branches, but also contain copies of every\ntree that has been recently modified on that branch. If subtree include has not been modified\nsince the branch became active, its contents will not be loaded into memory, but if subtree\nsrc has been modified by a commit since the branch became active, then its contents will be\nloaded in memory.\n\nAs active branches store metadata about the files contained on that branch, their in-memory\nstorage size can grow to a considerable size (see below).\n\nfast-import automatically moves active branches to inactive status based on a simple\nleast-recently-used algorithm. The LRU chain is updated on each commit command. The maximum\nnumber of active branches can be increased or decreased on the command line with\n--active-branches=.\n\n#### per active tree\n\nTrees (aka directories) use just 12 bytes of memory on top of the memory required for their\nentries (see “per active file” below). The cost of a tree is virtually 0, as its overhead\namortizes out over the individual file entries.\n\n#### per active file entry\n\nFiles (and pointers to subtrees) within active trees require 52 or 64 bytes (32/64 bit\nplatforms) per entry. To conserve space, file and tree names are pooled in a common string\ntable, allowing the filename “Makefile” to use just 16 bytes (after including the string\nheader overhead) no matter how many times it occurs within the project.\n\nThe active branch LRU, when coupled with the filename string pool and lazy loading of\nsubtrees, allows fast-import to efficiently import projects with 2,000+ branches and 45,114+\nfiles in a very limited memory footprint (less than 2.7 MiB per active branch).\n\n### SIGNALS\n\nSending SIGUSR1 to the git fast-import process ends the current packfile early, simulating a\ncheckpoint command. The impatient operator can use this facility to peek at the objects and\nrefs from an import in progress, at the cost of some added running time and worse\ncompression.\n\n### SEE ALSO\n\ngit-fast-export(1)\n\n### GIT\n\nPart of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                           GIT-FAST-IMPORT(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "git-fast-import",
        "section": "1",
        "mode": "man",
        "summary": "git-fast-import - Backend for fast Git data importers",
        "synopsis": "frontend | git fast-import [<options>]",
        "flags": [
            {
                "flag": "",
                "long": "--force",
                "arg": null,
                "description": "Force updating modified existing branches, even if doing so would cause commits to be lost (as the new commit does not contain the old commit)."
            },
            {
                "flag": "",
                "long": "--quiet",
                "arg": null,
                "description": "Disable the output shown by --stats, making fast-import usually be silent when it is successful. However, if the import stream has directives intended to show user output (e.g. progress directives), the corresponding messages will still be shown."
            },
            {
                "flag": "",
                "long": "--stats",
                "arg": null,
                "description": "Display some basic statistics about the objects fast-import has created, the packfiles they were stored into, and the memory used by fast-import during this run. Showing this output is currently the default, but can be disabled with --quiet."
            },
            {
                "flag": "",
                "long": "--allow-unsafe-features",
                "arg": null,
                "description": "Many command-line options can be provided as part of the fast-import stream itself by using the feature or option commands. However, some of these options are unsafe (e.g., allowing fast-import to access the filesystem outside of the repository). These options are disabled by default, but can be allowed by providing this option on the command line. This currently impacts only the export-marks, import-marks, and import-marks-if-exists feature commands. Only enable this option if you trust the program generating the fast-import stream! This option is enabled automatically for remote-helpers that use the `import` capability, as they are already trusted to run their own code."
            },
            {
                "flag": "",
                "long": "--done",
                "arg": null,
                "description": "Terminate with error if there is no done command at the end of the stream. This option might be useful for detecting errors that cause the frontend to terminate before it has started to write a stream."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "git-fast-export",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/git-fast-export/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "--force",
                        "lines": 3,
                        "long": "--force"
                    },
                    {
                        "name": "--quiet",
                        "lines": 4,
                        "long": "--quiet"
                    },
                    {
                        "name": "--stats",
                        "lines": 4,
                        "long": "--stats"
                    },
                    {
                        "name": "--allow-unsafe-features",
                        "lines": 12,
                        "long": "--allow-unsafe-features"
                    },
                    {
                        "name": "Options for Frontends",
                        "lines": 10
                    },
                    {
                        "name": "--done",
                        "lines": 4,
                        "long": "--done"
                    },
                    {
                        "name": "Locations of Marks Files",
                        "lines": 26
                    },
                    {
                        "name": "Submodule Rewriting",
                        "lines": 15
                    },
                    {
                        "name": "Performance and Compression Tuning",
                        "lines": 25
                    }
                ]
            },
            {
                "name": "PERFORMANCE",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "DEVELOPMENT COST",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "PARALLEL OPERATION",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "TECHNICAL DISCUSSION",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "INPUT FORMAT",
                "lines": 11,
                "subsections": [
                    {
                        "name": "Stream Comments",
                        "lines": 6
                    },
                    {
                        "name": "Date Formats",
                        "lines": 3
                    },
                    {
                        "name": "raw",
                        "lines": 20
                    },
                    {
                        "name": "raw-permissive",
                        "lines": 4
                    },
                    {
                        "name": "rfc2822",
                        "lines": 23
                    },
                    {
                        "name": "now",
                        "lines": 16
                    },
                    {
                        "name": "Commands",
                        "lines": 3
                    },
                    {
                        "name": "commit",
                        "lines": 3
                    },
                    {
                        "name": "tag",
                        "lines": 4
                    },
                    {
                        "name": "reset",
                        "lines": 3
                    },
                    {
                        "name": "blob",
                        "lines": 3
                    },
                    {
                        "name": "alias",
                        "lines": 5
                    },
                    {
                        "name": "checkpoint",
                        "lines": 4
                    },
                    {
                        "name": "progress",
                        "lines": 3
                    },
                    {
                        "name": "done",
                        "lines": 3
                    },
                    {
                        "name": "get-mark",
                        "lines": 3
                    },
                    {
                        "name": "cat-blob",
                        "lines": 7
                    },
                    {
                        "name": "feature",
                        "lines": 3
                    },
                    {
                        "name": "option",
                        "lines": 4
                    },
                    {
                        "name": "commit",
                        "lines": 40
                    },
                    {
                        "name": "author",
                        "lines": 5
                    },
                    {
                        "name": "committer",
                        "lines": 12
                    },
                    {
                        "name": "encoding",
                        "lines": 4
                    },
                    {
                        "name": "from",
                        "lines": 48
                    },
                    {
                        "name": "merge",
                        "lines": 9
                    },
                    {
                        "name": "filemodify",
                        "lines": 66
                    },
                    {
                        "name": "filedelete",
                        "lines": 10
                    },
                    {
                        "name": "filecopy",
                        "lines": 14
                    },
                    {
                        "name": "filerename",
                        "lines": 21
                    },
                    {
                        "name": "filedeleteall",
                        "lines": 17
                    },
                    {
                        "name": "notemodify",
                        "lines": 28
                    },
                    {
                        "name": "mark",
                        "lines": 14
                    },
                    {
                        "name": "original-oid",
                        "lines": 8
                    },
                    {
                        "name": "tag",
                        "lines": 35
                    },
                    {
                        "name": "reset",
                        "lines": 20
                    },
                    {
                        "name": "blob",
                        "lines": 13
                    },
                    {
                        "name": "data",
                        "lines": 42
                    },
                    {
                        "name": "alias",
                        "lines": 9
                    },
                    {
                        "name": "checkpoint",
                        "lines": 21
                    },
                    {
                        "name": "progress",
                        "lines": 16
                    },
                    {
                        "name": "get-mark",
                        "lines": 9
                    },
                    {
                        "name": "cat-blob",
                        "lines": 58
                    },
                    {
                        "name": "feature",
                        "lines": 33
                    },
                    {
                        "name": "option",
                        "lines": 25
                    },
                    {
                        "name": "done",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "RESPONSES TO COMMANDS",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "CRASH REPORTS",
                "lines": 77,
                "subsections": []
            },
            {
                "name": "TIPS AND TRICKS",
                "lines": 3,
                "subsections": [
                    {
                        "name": "Use One Mark Per Commit",
                        "lines": 9
                    },
                    {
                        "name": "Freely Skip Around Branches",
                        "lines": 8
                    },
                    {
                        "name": "Handling Renames",
                        "lines": 4
                    },
                    {
                        "name": "Use Tag Fixup Branches",
                        "lines": 21
                    },
                    {
                        "name": "Import Now, Repack Later",
                        "lines": 14
                    },
                    {
                        "name": "Repacking Historical Data",
                        "lines": 5
                    },
                    {
                        "name": "Include Some Progress Messages",
                        "lines": 5
                    }
                ]
            },
            {
                "name": "PACKFILE OPTIMIZATION",
                "lines": 18,
                "subsections": [
                    {
                        "name": "-a -d",
                        "lines": 10,
                        "flag": "-d"
                    }
                ]
            },
            {
                "name": "MEMORY UTILIZATION",
                "lines": 5,
                "subsections": [
                    {
                        "name": "per object",
                        "lines": 11
                    },
                    {
                        "name": "per mark",
                        "lines": 4
                    },
                    {
                        "name": "per branch",
                        "lines": 22
                    },
                    {
                        "name": "per active tree",
                        "lines": 4
                    },
                    {
                        "name": "per active file entry",
                        "lines": 9
                    }
                ]
            },
            {
                "name": "SIGNALS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "GIT",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}