0

I have

/Utilities

/Project1

/Project2

Project* depends on /Utilities

I track locally the projects. I want the git history of Projects to include /Utilities at the moment of each commit. So far I have not found a way to do this (except git: How do you add an external directory to the repository? but having a copy of the /Utilities in each Project* seems a bit messy.)

Is it possible? Otherwise, I can track /Utilities independently but in case of need analyzing the synchronized diffs seems that would be a lot more complex (at least it looks so to a beginner).

Community
  • 1
  • 1
tru7
  • 6,348
  • 5
  • 35
  • 59

1 Answers1

1

Any copy to source code is not a good idea, why not try git submodule?

Another alternative tool is repo, which google developed to manage modules of android sourcecode.

gzh
  • 3,507
  • 2
  • 19
  • 23
  • If I understand well the idea behind submodules, it is cloning /Utilities into /Project*. Being on a local setup (not shared) I don't see the advantage over simply doing a copy of /Utilities inside /Project* before commit. (My idea is to maintain /Utilities in its own working tree. An incremental copy into /Project* before each commit is starting to look better to me -very novice on git-) – tru7 Jul 22 '16 at 09:51
  • 1
    @Juan I must admit that if you have only one dependent modules, copy manually is not a bad method, maybe 'git submodules' is too heavy for this case. But when you have bunches of dependent modules, with deep source tree, version dependency, it is worthy to give 'git submodule' or 'repo' a try. – gzh Jul 22 '16 at 10:53