git-fast-import - Linux


Overview

git-fast-import is a specialized tool used to efficiently import large amounts of commit data into a Git repository. It is optimized for speed and is typically employed when importing history from a non-Git source, such as a Subversion or Mercurial repository.

Syntax

git fast-import --import-marks=<file> [options] <import-bundle>

Options/Flags

  • –import-marks=: Path to a file containing import marks.
  • –quiet: Suppress progress messages.
  • –date-format=: Set the custom date format for imported commits.
  • –export-marks=: Export the import marks to a file.
  • –allow-empty-commits: Allow the import of commits with no changes.
  • –threads=: Set the number of threads to use for importing.

Examples

Simple Import

git fast-import --import-marks=marks.txt < bundle.dump

Importing with Custom Date Format

git fast-import --import-marks=marks.txt --date-format=%ci \
  < bundle.dump

Common Issues

  • Permission Denied: Ensure you have write permissions for the target repository.
  • Invalid Import Marks: Check the format and validity of the import marks file.
  • Memory Usage: git-fast-import can be memory-intensive. Increase system memory or use the --threads option to optimize performance.

Integration

git-fast-import can be combined with other tools for advanced tasks:

  • git-svn: Import Subversion history using git svn fetch to create a bundle, then import the bundle with git-fast-import.
  • git-p4: Import Perforce history using git-p4 checkout to export a bundle, then import it with git-fast-import.

Related Commands