Skip to content

fast-export Git Command Guide

The git fast-export command is used to export Git data in a format suitable for piping into git fast-import. It dumps revisions in a human-readable format that can be used as bundle replacement or for history rewrites.

Terminal window
git fast-export [<options>]
OptionDescription
—progress=Insert progress statements every n objects
—signed-tags=(action)Handle signed tags (verbatim
—signed-commits=(action)Handle signed commits
-M, -CPerform move and copy detection
—export-marks=Dump marks table to file
—import-marks=Load marks from file
—mark-tagsLabel tags with mark IDs
—fake-missing-taggerFake tagger for old repos
—use-done-featureUse done stanza
—no-dataRefer to blobs by SHA-1 hash
—full-treeOutput deleteall + full file list
—anonymizeAnonymize repository contents
—tag-of-filtered-object=(action)Handle filtered tags
ParameterDescription
(none)Operates on current repository
[…]Optional commit ranges to export
Terminal window
git fast-export | git fast-import

Exports current repository and imports it back (creates a copy).

Terminal window
git fast-export --progress=100 | git fast-import

Shows progress every 100 objects during the import process.

Terminal window
git fast-export --export-marks=marks.txt HEAD | git fast-import --import-marks=marks.txt

Uses marks for incremental exports, allowing bidirectional syncing.

Terminal window
git fast-export -M -C HEAD~10..HEAD | git fast-import

Enables rename and copy detection in the exported stream.

Terminal window
git fast-export --anonymize | git fast-import

Removes identifying information while preserving repository structure.

Terminal window
git fast-export --no-data HEAD | gzip > repo.bundle.gz

Creates a compressed bundle with blob references instead of content.

To export the entire repository, run:

Terminal window
git fast-export HEAD | git fast-import

To handle incremental exports, use marks files:

Terminal window
git fast-export --export-marks=marks.txt HEAD
git fast-export --import-marks=marks.txt --export-marks=marks.txt NEW_COMMIT

To anonymize repository data, use the —anonymize option:

Terminal window
git fast-export --anonymize HEAD | git fast-import

git fast-export outputs a text stream format designed for git fast-import, containing commit, blob, and tree objects in a structured format suitable for editing and transformation.

To handle signed commits and tags, use:

Terminal window
git fast-export --signed-tags=warn-strip --signed-commits=warn-strip HEAD

How can I show progress during export/import?

Section titled “How can I show progress during export/import?”

To show progress during export/import operations, use —progress option with fast-import (fast-export doesn’t have built-in progress):

Terminal window
git fast-export HEAD | git fast-import --progress=50

Applications of the git fast-export command

Section titled “Applications of the git fast-export command”
  1. Repository migration between Git hosts
  2. Historical data rewriting and filtering
  3. Creating anonymized repository copies for testing
  4. Implementing custom Git transformation pipelines
  5. Backup and archival of repository in text format