1

I'm trying to use a subproject (Bundle) in my main project (Main), in a subtree (Main/path/to/Bundle).

Main                   (repository : remote/Main)
|- stuff
|- path
    |- to
       |- Bundle       (repository : remote/Bundle)
       |- otherstuff

What I want to keep is :
- For the subproject Bundle, the ability to pull, but also push for the specific sub directory only, to the remote repository dedicated to this sub project. - For the Main project, at best nothing to change : push / pull will affect only Main repository, and will include the subproject.

What I don't need :
- keep subproject Bundle's history in the Main project.

I understand that this is the way that dependencies work. But the subproject Bundle can't be publicly available. I have to find another solution.

I know subtree is a good solution, so is subrepo ( French : subtree vs subrepo ). But it requires learning new merge logic, or new concepts I don't have yet. I'm newbie at git stuff, I'd like to limit the new skills to master or git addons to install. Plus, I don't need to keep the history of the subtree, which was the main goal of subtree or subrepo if I understood it correctly.

Is there a simple way to do this ? Did I miss something obvious ?

Thank you for your time !

Stéphane
  • 500
  • 5
  • 22
  • 1
    This is solved by [submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules), and it's possible to [workaround to use private repositories](http://stackoverflow.com/a/10630771/2752041) as well. I see it as the simplest solution, but even then it requires a bit of reading and digging - there's no magic wand for what you need. Regarding history: since we're talking about **git** repositories (main, sub(module|repo|tree)), they will all have history, no matter what :) – mathielo Dec 29 '16 at 11:19
  • 1
    Yes, submodules are made for the problem described here. I would like to clarify one thing. The OP said they don't need Bundle's history in the main project. Good, because that is how submodules work. They are a separate module, so the supermodule "main" doesn't need or have the submodules history. This also solves the requirement that Bundle not be publicly available. SInce it is an independent repo, it can be where ever it needs to be. – Randy Leberknight Dec 29 '16 at 23:13
  • 1
    Ok so, you all recommand using submodules ? I've read that subtrees are easier to use, and indeed when I tried that worked fast. But I want to do things the right way. Should I switch to submodules ? – Stéphane Dec 30 '16 at 09:12

0 Answers0