3

I have a user github.com/userName that has 50+ Repositories that I would like to clone into a single dir on my Windows PC. What would be the best way to do this?

Jess SM
  • 33
  • 3

1 Answers1

1

One way would be to create one more repo in which you declare your 50+ repos as submodules.

That way, you would be able to initialize/clone your 50 repos with a

git clone --recursive your_main_parent_repo

(See "How to git clone including submodules?")

Don't forget to commit and push your main_repo when you have committed and push any of your submodules though.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I like that idea! - Though with the need to update the master project any time any other project is updated, I'm not sure how much faster this would be than just having 50 separate repositories in a single dir of the windows PC, and a batch file to pull them all down whenever needed. – Julian Higginson Sep 10 '12 at 04:20
  • @JulianHigginson the idea is not to maintain an external script, and to memorize the state of your 50 repos by only one git commit and git push in your parent repo (ie: you don't have to commit-push each time you are making one change in one of the subrepos) – VonC Sep 10 '12 at 05:52
  • "Don't forget to commit and push your main_repo when you have committed and push any of your submodules though." - this gave me the impression you need to remember to commit and push both "submodule" and "main_parent" every time you make progress on any "submodule" project? That sounds like a process that could get messed up easily... But I'm not experienced with submodules, so may be missing something here. – Julian Higginson Sep 11 '12 at 05:25
  • @JulianHigginson you don't have to push the parent repo *everytime* you are pushing a modification from one of the submodules. You do have to push the parent repo when you want to clone those 50 subrepos again in their exact current state (or when you want a collaborator to clone them) See http://stackoverflow.com/questions/1979167/git-submodule-update/1979194#1979194 for more on that double step. – VonC Sep 11 '12 at 05:34
  • Aaah, excellent! In that case, I completely agree with your solution. Thanks for taking the time to explain your explanation further for me! – Julian Higginson Sep 11 '12 at 07:56