The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

git-stitch-repo - Stitch several git repositories into a git-fast-import stream

SYNOPSIS

git-stitch-repo [ options ] repo1 repo2:dir2 ...

OPTIONS

    --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

DESCRIPTION

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

The 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.

SEE ALSO

Git::FastExport::Stitch

AUTHOR

Philippe Bruhat (BooK), <book@cpan.org>.

ACKNOWLEDGEMENTS

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

Copyright 2008-2009 Philippe Bruhat (BooK), All Rights Reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.