Stitch several git repositories (merging git repository) into a git fast-import stream from Git-FastExport


$ perl -MCPAN -e shell
cpan[6]> i /fastexport/
	Distribution    BOOK/Git-FastExport-0.107.tar.gz
	Module  < Git::FastExport        (BOOK/Git-FastExport-0.107.tar.gz)
	Module  < Git::FastExport::Block (BOOK/Git-FastExport-0.107.tar.gz)
	Module  < Git::FastExport::Stitch (BOOK/Git-FastExport-0.107.tar.gz)
	4 items found

cpan[6]> install BOOK/Git-FastExport-0.107.tar.gz

cpan[6]> CTRL-D


git-stitch-repo will process the output of git fast-export --all --date-order on the git repositories given on the command-line, and create a stream suitable for git fast-import that will create a new repository containing all the commits in a new commit tree that respects the history of all the source repositories. Typical usage is like this:
git clone
git clone

$ ls

mkdir result
cd result
git init
git-stitch-repo ../A:folderA ../B:folderB | git fast-import

# pull both repository in a new branch for examples
git checkout -b newBranch
git pull . master-A
git pull . master-B

# when finished delete unused branches
git branch -d master-A 
git branch -d master-B