I'm making a git extension. It's in its own git repo. To run tests, I have created several test repos which are used by my project. Currently they are submodules of the main repo.

I am dissatisfied with this. Firstly they themselves need to be cloned (in case the original cloner didn't use --recursive) as part of the test setup, but, more importantly, the project is not self-contained. One can't just migrate the project to another server without taking care of the helper submodules. Even if you have cloned the original repo, you need to make sure you have access to the helpers.

So, since I need a test setup anyway, I was considering instead of using submodules to build the test repos to their desired state from scratch with helper scripts.

Then I figured that it will probably be more efficient to create the bare test repos myself once, add them as a tarball in the original, and unpack it as part or the test setup.

Then I wondered... is there an even easier way to do this? Can I safely add entire git repos inside of another instead of using submodules? Then there won't even be a need for a test setup.

  • see Where does my git question go?
    – gnat
    Commented Dec 8, 2020 at 18:00
  • 1
    I still think this is more of a SE (a workflow) question than a "question about git the tool". It's about the concept of adding entire git repos inside of another. What is the best way to do it? But thanks for downvoting without reading :) Commented Dec 8, 2020 at 18:32

1 Answer 1


Depending on the contents of the git repos, I would prefer to create them programatically. e.g dont check in a tarball or the git repo itself, but instead check in a script that creates the repo from scratch.

The advantages being: the script is small and easy to deal with. Also it could sidestep som issues with old repos. In general git is fairly stable, but there could be some corner cases when working on a 10+ years old repo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.