git-stitch-repo - Stitch several git repositories into a git fast-import stream
git-stitch-repo [ options ] repo1:dir1 repo2:dir2 ...
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:
$ ls A B $ mkdir RESULT $ cd RESULT $ git init $ git-stitch-repo ../A:A ../B:B | git fast-import
RESULT repository will contain all commits from repositories A and B, with the files from A in subdirectory A/ and the files from B in subdirectory B/.
$ git checkout master-A warning: You appear to be on a branch yet to be born. warning: Forcing checkout of master-A. Switched to branch "master-A" $ git checkout master-B Switched to branch "master-B"
Both branches can be seen using
gitk --all. It is now possible to create the master branch and have it point at the right commit, and delete the two master-A and master-B branches.
git-stich-repo works perfectly with repositories that have a linear history (no merges). It has successfully been tested with 16 linear repositories, and produced the expected result.
The improvements to the stitching algorithm added in version 0.06 should make is suitable to work with repositories having branches and merges.
--select < first | last | random > Algorithm for selection the attachment commit --help Print a short online help and exit --manual Print the full manual page and exit --version Print version information and exit
Please report any bugs or feature requests on the bugtracker website http://rt.cpan.org/NoAuth/Bugs.html?Dist=Git-FastExport or by email to firstname.lastname@example.org.
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Philippe Bruhat (BooK) <email@example.com>
The original version of this script was created as part of my work for BOOKING.COM, which authorized its publication/distribution under the same terms as Perl itself.
Copyright 2008-2009 Philippe Bruhat (BooK), All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.