How to stop sharing objects between repositories
- From
Jon Jensen <jon@endpoint.com>
- Date
- Aug 16, 2009, 00:04 UTC
- Message-ID
- <alpine.DEB.2.00.0908151756150.29215@nhtr.ovalna.fjrygre.arg>
Hello.
Situation: I used "git clone -s" to share objects between repositories. That creates .git/objects/info/alternates, which points to the other repository. Later I need to remove the dependency and make the dependent repository self-sufficient, i.e. it should have all the objects internal to itself.
I've looked around for a way to do that but haven't found either tools or instructions.
I came up with this manual way, copying over the unique remote objects and then removing the alternate repository pointer:
(cd /path/to/alternate/repo.git/objects && tar cp .) | (cd .git/objects && tar xvpk) # some objects will already exist and be skipped, leading to an error on exit, which is fine rm .git/objects/info/alternates # or if there's more than one and you're only removing one, edit the alternates file and remove only that pointer
(With GNU tar -C the copy is a little simpler.)
I posted this to the wiki:
http://git.or.cz/gitwiki/GitFaq#Howtostopsharingobjectsbetweenrepositories.3F
If there's a better or built-in way to do this with Git tools, I'd like to learn it, and I'd be happy to update the wiki accordingly.
Thanks, Jon
-- Jon Jensen End Point Corporation http://www.endpoint.com/