-1

I'm in the situation where I'm developing two projects at the same time, where the second project is used by the first project, but is intended to be reusable by other projects. For this reason, I've been keeping them in two separate repos. I can foresee that this will bring huge headaches somewhere down the line, though. My worry is that I will make many commits to project 1 and 2 in parallel, then be forced to revert to an earlier commit in project 1 only to find that I need to also revert project 2 in order to even compile project 1. Tracking these two projects in separate repos is less than ideal for this reason, but I don't think I should track project 2 in project 1's repo. What is a better solution for this?

Using source controlled libraries in source controlled projects

This particular question suggests using mercurial subrepos. This sounds like a sort of good idea (in that it would work, but is cautioned against by mercurial). Unfortunately, I'm using git, and I don't know of any equivalents.

Community
  • 1
  • 1
Jason_L_Bens
  • 374
  • 3
  • 14

1 Answers1

1

Nearest iteration to Mercurial's subrepos in Git is Git submodules, which have own problems and edge-corners (but in any case main repo and module have hard linking in each changeset, thus you always can restore the whole repository to the exact state as it was earlier) and Git subtree may be considered as good alternative with improved (but identical in common sense) functionality

Good blog-post about using Git subtree from Pardus: Modular git with "git subtree"

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • Subtrees look pretty useful. I'll give it a try, and see how it goes. I'll keep the question open for a bit longer to see if any other suggestions come in, but this looks like it may be the best method. – Jason_L_Bens Aug 01 '13 at 08:39
  • I got a chance to implement it, today, and it seems to work pretty slick. Maybe just because subtrees are new, but there doesn't seem to be a lot of documentation out there with clear examples. I got it working in my case, but it may be useful to link a few simple guides in your answer for future readers. – Jason_L_Bens Aug 02 '13 at 03:58