I have a git project with 200+ individual remotes, all of which I fetched to my local machine. Yes, maybe this wasn't the right thing to do. I'm honestly not sure. It was the recommended way of getting the data, but it's not worked out as well as I'd hoped. What I want to do is to split the repository into separate local repositories, each a clone of one of the remotes in the "big" repo. But I don't want to fetch the remotes again - the initial fetch took about 12 hours and I'd rather avoid spending the time (and bandwidth) again.
The repository I currently have downloaded has about 230 remotes, named pypi-mirror-N.git
for N from 1 to about 230. There's no working tree in the repository, all of the data is only in the pack files, and is accessed using commands like git rev-list
or git cat-file
. Each remote in the repo has two branches: remotes/pypi-mirror-N.git/code
and remotes/pypi-mirror-N.git/main
. The repo itself has no commits on the main branch (it was created via git init
, a series of git remote add
and then a git fetch
).
A repository this size is, however, unusably slow for me (on a relatively high-end Windows PC) - git rev-list --objects --all | wc -l
takes 30 minutes or more.
An alternative approach would be to git clone
each repository individually. Doing so would mean I'd need to keep track manually of which repository each individual file was in, but that's an acceptable trade-off for good performance. Individual repos have the same structure (no working tree, the data just in the packs) with 4 branches: main
, remotes/origin/HEAD -> origin/main
, remotes/origin/code
, and remotes/origin/main
.
Rather than cloning all of the repos again, I'd much rather save on bandwidth and time by copying the relevant data from my current "all in one" repo, into individual repos created locally. I'm assuming I need to copy remotes/pypi-mirror-N.git/code
in the big repo to remotes/origin/code
, and remotes/pypi-mirror-N.git/main
to all of main
, origin/main
, and remotes/origin/main
. But it's not clear to me how to do that.
Is this possible? Ideally, I'd prefer it if I could avoid having 2 copies of the data locally as that would use a significant chunk of my disk.