git fast-import

Administration

Build a repository from a fast-import stream


The 'git fast-import' command reads a text stream of blobs and commits (as written by git fast-export or by migration tools for other version-control systems) and writes them into the repository at high speed. It is the engine behind most imports into Git.

Synopsis

git fast-import [<options>] < <stream>
[ ] optional| or<arg> placeholder... repeatable--flag option

Examples

Import a stream

git fast-import < repo.fi

Rebuild the history in this repository.


Copy a repository

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

Export here, import there.

Workflow Examples

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

Export

2
edit repo.fi with a script

Transform

3
git fast-import < repo.fi

Import into a fresh repository

Troubleshooting

fatal: Unsupported command

Cause: The stream is malformed

Check the line the error names; the format is strict

Tips & Pitfalls

Best Practices

  • ✓Import into a new, empty repository.

FAQ

A:

Mostly — and for tools like git filter-repo that rewrite history through it.