0

All my projects have the same structure, base files (each containing some code).

Things I would like :

  • Version this code ;
  • Use it in other projects ;
  • Be able to update it in those projects ;
  • Only add code in those files, specific to each project (don't need to remove or to alter existing code).

I made some research. Using a package manager wouldn't suit my needs as i would like to add code to the package. I then found git submodules and subtrees and the latter seems to do the job.

What do you think about it ? Am I going in the right path by choosing subtrees or is there a better method ? Should I be using a complete different solution ?

Thanks guys

[EDIT]

More infos :

This "starter kit" is somewhat like a framework. I'm considering to build it in a way that doesn't need to edit its files in other projects but that would add constraints.

  • I don't think submodules would fit as i need to work on the code ;
  • Each project needs its own repo.
Andréa Maugars
  • 415
  • 3
  • 7

2 Answers2

0

Just make a master git repo, and clone that; you can have different branches for different variations of your base files.

This is pretty basic git usage.

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94
0

This seems overly complicated, but depending on how similar the codebase is and whether they are actually different projects you might want to use branches or make one repo with the shared code and then just clone (or to be fancier, add as a submodule) that into the repos for other projects. So if your shared code is shared and you have projects foo and bar you'd make 3 separate repos and clone (or submodule add) shared into foo and bar. It really depends on how often you'll be updating shared and how separate foo and bar are

marisbest2
  • 1,346
  • 2
  • 17
  • 30
  • `foo` and `bar` might be completely different projects but they will be built upon the same structure and code. My understanding of submodule is quite limited. I think the fact i want to edit the submodule in each project will be problematic. – Andréa Maugars May 29 '16 at 15:32