Generated repository within a repository

Viewed 43

What I'm trying to do

Here's my github repository:

https://github.com/dharmatech/LinkAggregatorTutorial

Inside that repository is a PowerShell script: LinkAggregatorTutorial.ps1

That script generates a new git repository, named LinkAggregator.

Ideally, I'd like to keep that generated repository inside the LinkAggregatorTutorial repository.

The issue

The issue is, I would imagine that this is an unusual arrangement; i.e. having a repository inside another repository.

I did a little bit of research on this topic and found git submodules. However, at first glance, my use case doesn't seem to be exactly the right target for submodules. The generated git repository (LinkAggregator) isn't a dependency of the parent repository (LinkAggregatorTutorial).

So my question is, is there a good way to set this up?

Options

To summarize, my current options are:

  1. Just put LinkAggregator inside LinkAggregatorTutorial and it'll just work.
  2. Make LinkAggregator a submodule of LinkAggregatorTutorial
  3. Don't try to keep LinkAggregator inside LinkAggregatorTutorial. Simply host it in another repository on github. (Although, then I seem to run into the same issue there. Moreover, LinkAggregator can't really be a top-level standalone repository since it is generated from scratch every so often.)
  4. Generate LinkAggregator inside LinkAggregatorTutorial but then remove the LinkAggregator/.git directory, rendering it just a normal folder with files in it as opposed to a full on git repository. The drawback is, it's no longer a repository, but I may be able to live with that. The important thing is that the user can see the generated project. If the user generates the project on their system, they'll of course still get the full git repository.
  5. Have LinkAggregatorTutorial/.gitignore include LinkAggregator/.git. This way, locally, LinkAggregator is still a git repository. But as far as github is concerned, it's just a regular folder.
  6. Some other arrangement...

More context

A little more context:

  • LinkAggregatorTutorial.ps1 is a PowerShell script that generates the LinkAggregator repository (it's an ASP.NET Core project).
  • Every once in a while, I'll be updating LinkAggregatorTutorial.ps1 and then regenerating the LinkAggregator repository. Thus, I won't be making little incremental updates to LinkAggregator (as is normally done with a git repository). It's automatically generated and thus, a completely new repository will be generated from time to time. It's this repository that I'd like to have inside LinkAggregatorTutorial.
  • LinkAggregatorTutorial.md is the rendered version of tutorial. The reader is meant to go through that manually. However, then can, if they choose, run the tutorial to generate the final project, just to test if the steps work on their system. I'd like to, of course, also provide the generated project on github.

Update

Upon writing all this out, it seems like option 4 is a practical approach and I'm leaning towards it. But, I figured I'd leave this question up to see if a git wizard has any thoughts or suggestions on this scenario.

1 Answers

If there's some dependency between the two repos, you should use submodules.

But you wrote that the generated git repository isn't a dependency of the parent repository. So in this case, one shouldn't reside inside the other. They should be two completely separate repos.

Related