Half of repo-to-repo migration. Pairs with fast-import.
git fast-export serializes commits, trees, blobs, refs, and tags into a plain-text stream that git fast-import (or any compatible tool) can replay. It is how you move history between repos, anonymize a repo for a bug report, or feed Git data into another VCS.
Reads from the object database and refs; writes a stream to stdout. Nothing is mutated. The stream is a deterministic, line-oriented format documented in git-fast-import(1); marks files let you resume or chain exports.
git fast-export [<options>] | git fast-import
git fast-export --all [--signed-tags=<mode>] [--tag-of-filtered-object=<mode>]
[-M] [-C] [--reencode=(yes|no|abort)] [--refspec=<refspec>]
[--export-marks=<file>] [--import-marks=<file>]
[--mark-tags] [--fake-missing-tagger] [--use-done-feature]
[--no-data] [--full-tree] [--anonymize] [--reference-excluded-parents]
[--show-original-ids] [--] [<git-rev-list-args>...]| Flag | What it does |
|---|---|
--all | Export every ref. The usual choice when cloning an entire repo into a stream. |
--export-marks=<file> | Write a mark->sha map. Required if you want to do incremental exports later. |
--import-marks=<file> | Read a previous mark map so subsequent runs only emit new objects. |
--no-data | Omit blob contents. Useful when paired with a separate transfer of blobs, or for shape-only debugging. |
--anonymize | Replace paths, identities, and commit messages with consistent gibberish. The right way to ship a repro to a maintainer. |
--reencode=(yes|no|abort) | Control encoding conversion for encoding headers. Default is abort on conflict in modern Git. |
--signed-tags=<mode> | What to do with PGP-signed tags: verbatim, warn, warn-strip, strip, or abort. Signatures generally do not survive a round-trip. |
--anonymize.--export-marks / --import-marks.$ git -C src fast-export --all \
| git -C dst fast-import$ git fast-export --all --anonymize \
--anonymize-map=secret-stuff:placeholder \
> anon.stream# first run
$ git fast-export --all --export-marks=marks.out > full.stream
# next day
$ git fast-export --all --import-marks=marks.out --export-marks=marks.out \
> delta.stream$ git fast-export --signed-tags=strip main~100..main > recent.stream--all plus a marks file. Anything else and you will lose tags or skip refs you cared about.--anonymize. Assume your filenames are also confidential.fast-import when copying locally. Disk-staging the stream is just slower and consumes space.--signed-tags mode consciously or the import side will choke.--export-marks, every run re-streams the entire history. Mirrors get expensive fast.--no-data produces a stream that fast-import cannot reconstruct objects from on its own; you need the source repo's object database alongside.Hit each option, then Check answers. Score is recorded; Next is always open.