Connect Git History of multiple Repos

I try out to make a Git History Cut and connect the historys of the 2 repos.

Git Log repo "archiv":

9aa472d04501a14b5b704fde32445461f99f539a 3
1d0e5abe5daf60c0d86819938ba1aefd44b87ff5 2
766f4880e8ccf61bdc718dfae62466f800ae8119 1

Git Log repo "new":

2932c4b8ea681f0a97bf151ccc46d2044e8e5a50 5
27ec1a4618f1bf0025b8ba83fd69c2607cdf78d4 4

I linked the both repos in the alternates file and connect it with

git replace --graft 27ec1a4618f1bf0025b8ba83fd69c2607cdf78d4 9aa472d04501a14b5b704fde32445461f99f539a

and it worked, so i see on my repo new the old commits of the archiv.


Problem:

But now i want to split the repo new and make a second history cut. So i get the repo new2 with new commits.

Git Log repo "new2":

90c767f43f35a2e21d8a3b8b3741495bd8afeff3 7
6c396ae0bff3ffba267a7a280c36174413ffc20c 6

But now if I write the repo new-path in the alternates file of new2 and linked this with git replace I see only the commits of new and new2, and not the linked archiv to new.

I try to add the archiv-path to the alternates file of new2

C:\GIT\RepoCut\3fach\archiv.git\objects
C:\GIT\RepoCut\3fach\new.git\objects

and make a git replace on commit 4 and 3 to see all commits, but I get the error and my old connection with new breaks:

does not exist; check .git/objects/info/alternates./objects
fatal: could not parse 27ec1a4618f1bf0025b8ba83fd69c2607cdf78d4

Can I linked a second repo (archiv) to my repo new2 to see the full history?

1 answer

  • answered 2018-07-12 07:57 petrpulc

    The content of the .git/objects/info/alternates file has to follow definition of environment variable

    The paths have to be, therefore, separated by a semicolon (;) and content of your file should look like:

    C:\GIT\RepoCut\3fach\archiv.git\objects;C:\GIT\RepoCut\3fach\new.git\objects