Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/Documentation/git-fast-import.adoc # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / Documentation / git-fast-import.adoc` 1687 lines ยท 64288 bytes Raw Blame History 1 git-fast-import(1) 2 ================== 3 4 NAME 5 ---- 6 git-fast-import - Backend for fast Git data importers 7 8 9 SYNOPSIS 10 -------- 11 [verse] 12 'git fast-import' [] 13 14 DESCRIPTION 15 ----------- 16 This program is usually not what the end user wants to run directly. 17 Most end users want to use one of the existing frontend programs, 18 which parses a specific type of foreign source and feeds the contents 19 stored there to 'git fast-import'. 20 21 fast-import reads a mixed command/data stream from standard input and 22 writes one or more packfiles directly into the current repository. 23 When EOF is received on standard input, fast import writes out 24 updated branch and tag refs, fully updating the current repository 25 with the newly imported data. 26 27 The fast-import backend itself can import into an empty repository (one that 28 has already been initialized by 'git init') or incrementally 29 update an existing populated repository. Whether or not incremental 30 imports are supported from a particular foreign source depends on 31 the frontend program in use. 32 33 34 [[OPTIONS]] 35 OPTIONS 36 ------- 37 38 --force:: 39 Force updating modified existing branches, even if doing 40 so would cause commits to be lost (as the new commit does 41 not contain the old commit). 42 43 --quiet:: 44 Disable the output shown by --stats, making fast-import usually 45 be silent when it is successful. However, if the import stream 46 has directives intended to show user output (e.g. `progress` 47 directives), the corresponding messages will still be shown. 48 49 --stats:: 50 Display some basic statistics about the objects fast-import has 51 created, the packfiles they were stored into, and the 52 memory used by fast-import during this run. Showing this output 53 is currently the default, but can be disabled with --quiet. 54 55 --allow-unsafe-features:: 56 Many command-line options can be provided as part of the 57 fast-import stream itself by using the `feature` or `option` 58 commands. However, some of these options are unsafe (e.g., 59 allowing fast-import to access the filesystem outside of the 60 repository). These options are disabled by default, but can be 61 allowed by providing this option on the command line. This 62 currently impacts the following feature commands: 63 + 64 -- 65 * `export-marks` 66 * `import-marks-if-exists` 67 * `import-marks` 68 * `rewrite-submodules-from` 69 * `rewrite-submodules-to` 70 -- 71 And the following options: 72 + 73 -- 74 * `export-pack-edges` 75 -- 76 + 77 Only enable this option if you trust the program generating the 78 fast-import stream! This option is enabled automatically for 79 remote-helpers that use the `import` capability, as they are 80 already trusted to run their own code. 81 + 82 Note that this option has to be spelled in full, and has to appear 83 before any option whose value is separated from it by a space, for 84 the unsafe `feature` commands in the stream to be allowed. So 85 `--allow-unsafe` or `--depth 5 --allow-unsafe-features` still refuse 86 them, while `--allow-unsafe-features --depth 5` and 87 `--depth=5 --allow-unsafe-features` allow them. 88 89 `--signed-tags=`:: 90 Specify how to handle signed tags. Behaves in the same way as 91 the `--signed-commits=` below. Like for signed commits, 92 the default mode is `verbatim`. 93 94 `--signed-commits=`:: 95 Specify how to handle signed commits. The following s 96 are supported: 97 + 98 * `verbatim`, which is the default, will silently import commit 99 signatures. 100 * `warn-verbatim` will import them, but will display a warning. 101 * `abort` will make this program die when encountering a signed 102 commit. 103 * `strip` will silently make the commits unsigned. 104 * `warn-strip` will make them unsigned, but will display a warning. 105 * `strip-if-invalid` will check signatures and, if they are invalid, 106 will strip them and display a warning. The validation is performed 107 in the same way as linkgit:git-verify-commit[1] does it. 108 * `sign-if-invalid[=]`, similar to `strip-if-invalid`, verifies 109 commit signatures and replaces invalid signatures with newly created ones. 110 Valid signatures are left unchanged. If `` is provided, that key is 111 used for signing; otherwise the configured default signing key is used. 112 * `abort-if-invalid` will make this program die when encountering a signed 113 commit that is unable to be verified. 114 115 Options for Frontends 116 ~~~~~~~~~~~~~~~~~~~~~ 117 118 --cat-blob-fd=:: 119 Write responses to `get-mark`, `cat-blob`, and `ls` queries to the 120 file descriptor instead of `stdout`. Allows `progress` 121 output intended for the end-user to be separated from other 122 output. 123 124 --date-format=:: 125 Specify the type of dates the frontend will supply to 126 fast-import within `author`, `committer` and `tagger` commands. 127 See ``Date Formats'' below for details about which formats 128 are supported, and their syntax. 129 130 --done:: 131 Terminate with error if there is no `done` command at the end of 132 the stream. This option might be useful for detecting errors 133 that cause the frontend to terminate before it has started to 134 write a stream. 135 136 Locations of Marks Files 137 ~~~~~~~~~~~~~~~~~~~~~~~~ 138 139 --export-marks=:: 140 Dumps the internal marks table to when complete. 141 Marks are written one per line as `:markid SHA-1`. 142 Frontends can use this file to validate imports after they 143 have been completed, or to save the marks table across 144 incremental runs. As is only opened and truncated 145 at checkpoint (or completion) the same path can also be 146 safely given to --import-marks. 147 148 --import-marks=:: 149 Before processing any input, load the marks specified in 150 . The input file must exist, must be readable, and 151 must use the same format as produced by --export-marks. 152 Multiple options may be supplied to import more than one 153 set of marks. If a mark is defined to different values, 154 the last file wins. 155 156 --import-marks-if-exists=:: 157 Like --import-marks but instead of erroring out, silently 158 skips the file if it does not exist. 159 160 --relative-marks:: 161 --no-relative-marks:: 162 After specifying --relative-marks the paths specified 163 with --import-marks= and --export-marks= are relative 164 to an internal directory in the current repository. 165 In git-fast-import this means that the paths are relative 166 to the .git/info/fast-import directory. However, other 167 importers may use a different location. 168 + 169 Relative and non-relative marks may be combined by interweaving 170 --(no-)-relative-marks with the --(import|export)-marks= options. 171 172 Submodule Rewriting 173 ~~~~~~~~~~~~~~~~~~~ 174 175 --rewrite-submodules-from=::: 176 --rewrite-submodules-to=::: 177 Rewrite the object IDs for the submodule specified by from the values 178 used in the from to those used in the to . The from marks should 179 have been created by `git fast-export`, and the to marks should have been 180 created by `git fast-import` when importing that same submodule. 181 + 182 may be any arbitrary string not containing a colon character, but the 183 same value must be used with both options when specifying corresponding marks. 184 Multiple submodules may be specified with different values for . It is an 185 error not to use these options in corresponding pairs. 186 + 187 These options are primarily useful when converting a repository from one hash 188 algorithm to another; without them, fast-import will fail if it encounters a 189 submodule because it has no way of writing the object ID into the new hash 190 algorithm. 191 192 Performance and Compression Tuning 193 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 195 --active-branches=:: 196 Maximum number of branches to maintain active at once. 197 See ``Memory Utilization'' below for details. Default is 5. 198 199 --big-file-threshold=:: 200 Maximum size of a blob that fast-import will attempt to 201 create a delta for, expressed in bytes. The default is 512m 202 (512 MiB). Some importers may wish to lower this on systems 203 with constrained memory. 204 205 --depth=:: 206 Maximum delta depth, for blob and tree deltification. 207 Default is 50. 208 209 --export-pack-edges=:: 210 After creating a packfile, print a line of data to 211 listing the filename of the packfile and the last 212 commit on each branch that was written to that packfile. 213 This information may be useful after importing projects 214 whose total object set exceeds the 4 GiB packfile limit, 215 as these commits can be used as edge points during calls 216 to 'git pack-objects'. 217 218 --max-pack-size=:: 219 Maximum size of each output packfile. 220 The default is unlimited. 221 222 fastimport.unpackLimit:: 223 See linkgit:git-config[1] 224 225 PERFORMANCE 226 ----------- 227 The design of fast-import allows it to import large projects in a minimum 228 amount of memory usage and processing time. Assuming the frontend 229 is able to keep up with fast-import and feed it a constant stream of data, 230 import times for projects holding 10+ years of history and containing 231 100,000+ individual commits are generally completed in just 1-2 232 hours on quite modest hardware (~$2,000 USD in 2007). 233 234 Most bottlenecks appear to be in foreign source data access (the 235 source just cannot extract revisions fast enough) or disk IO (fast-import 236 writes as fast as the disk will take the data). Imports will run 237 faster if the source data is stored on a different drive than the 238 destination Git repository (due to less IO contention). 239 240 241 DEVELOPMENT COST 242 ---------------- 243 A typical frontend for fast-import tends to weigh in at approximately 200 244 lines of Perl/Python/Ruby code. Most developers have been able to 245 create working importers in just a couple of hours, even though it 246 is their first exposure to fast-import, and sometimes even to Git. This is 247 an ideal situation, given that most conversion tools are throw-away 248 (use once, and never look back). 249 250 251 PARALLEL OPERATION 252 ------------------ 253 Like 'git push' or 'git fetch', imports handled by fast-import are safe to 254 run alongside parallel `git repack -a -d` or `git gc` invocations, 255 or any other Git operation (including 'git prune', as loose objects 256 are never used by fast-import). 257 258 fast-import does not lock the branch or tag refs it is actively importing. 259 After the import, during its ref update phase, fast-import tests each 260 existing branch ref to verify the update will be a fast-forward 261 update (the commit stored in the ref is contained in the new 262 history of the commit to be written). If the update is not a 263 fast-forward update, fast-import will skip updating that ref and instead 264 prints a warning message. fast-import will always attempt to update all 265 branch refs, and does not stop on the first failure. 266 267 Branch updates can be forced with --force, but it's recommended that 268 this only be used on an otherwise quiet repository. Using --force 269 is not necessary for an initial import into an empty repository. 270 271 272 TECHNICAL DISCUSSION 273 -------------------- 274 fast-import tracks a set of branches in memory. Any branch can be created 275 or modified at any point during the import process by sending a 276 `commit` command on the input stream. This design allows a frontend 277 program to process an unlimited number of branches simultaneously, 278 generating commits in the order they are available from the source 279 data. It also simplifies the frontend programs considerably. 280 281 fast-import does not use or alter the current working directory, or any 282 file within it. (It does however update the current Git repository, 283 as referenced by `GIT_DIR`.) Therefore an import frontend may use 284 the working directory for its own purposes, such as extracting file 285 revisions from the foreign source. This ignorance of the working 286 directory also allows fast-import to run very quickly, as it does not 287 need to perform any costly file update operations when switching 288 between branches. 289 290 INPUT FORMAT 291 ------------ 292 With the exception of raw file data (which Git does not interpret) 293 the fast-import input format is text (ASCII) based. This text based 294 format simplifies development and debugging of frontend programs, 295 especially when a higher level language such as Perl, Python or 296 Ruby is being used. 297 298 fast-import is very strict about its input. Where we say SP below we mean 299 *exactly* one space. Likewise LF means one (and only one) linefeed 300 and HT one (and only one) horizontal tab. 301 Supplying additional whitespace characters will cause unexpected 302 results, such as branch names or file names with leading or trailing 303 spaces in their name, or early termination of fast-import when it encounters 304 unexpected input. 305 306 Stream Comments 307 ~~~~~~~~~~~~~~~ 308 To aid in debugging frontends fast-import ignores any line that 309 begins with `#` (ASCII pound/hash) up to and including the line 310 ending `LF`. A comment line may contain any sequence of bytes 311 that does not contain an LF and therefore may be used to include 312 any detailed debugging information that might be specific to the 313 frontend and useful when inspecting a fast-import data stream. 314 315 Date Formats 316 ~~~~~~~~~~~~ 317 The following date formats are supported. A frontend should select 318 the format it will use for this import by passing the format name 319 in the --date-format= command-line option. 320 321 `raw`:: 322 This is the Git native format and is `