git fast-export

Administration

Export history as a fast-import text stream


The 'git fast-export' command writes the history of branches as a plain-text stream: every file version (blob) with a mark, and every commit referring to them. The stream can be edited, filtered, or fed to git fast-import (or another version-control system) to rebuild the history — the basis of many migration and history-rewriting tools.

Synopsis

git fast-export [--all] [<rev-list-options>...]
[ ] optional| or<arg> placeholder... repeatable--flag option

Options

Click any option to expand

Beginner (1)

Export every branch and tag.

RecommendedExport the complete repository

Example

git fast-export --all

Choosing the Right Option

Moving history

Stream, bundle or clone

CommandFormat
git fast-exportReadable text stream
git bundleBinary pack in one file
git cloneA full repository

Examples

One branch

git fast-export main > main.fi

The history of main as text.


Everything

git fast-export --all > repo.fi

Every branch and tag.


Copy a repository

git fast-export --all | (cd ../copy && git fast-import)

Rebuild the history elsewhere.

Workflow Examples

1
git fast-export --all > repo.fi

Export

2
othertool fast-import < repo.fi

Most VCSs read this format

Troubleshooting

Signed commits abort the export

Cause: Signatures cannot be kept in the stream

Add --signed-tags=strip (and --signed-commits=strip on newer Git)

Tips & Pitfalls

Best Practices

  • ✓For history rewriting, prefer git filter-repo over hand-editing a stream.

Common Mistakes

  • ✗Editing the stream by hand for big rewrites — use git filter-repo, which is built on it.

FAQ

A:

A number like :3 naming a blob or commit in the stream, so later entries can refer to it.