6

I've used git for my personal projects for years, but that's always working alone, not needing to branch much, etc.
Our development team at work has decided we are definitely switching to git, and as one of the most experienced git user on the team I have the task of figuring out our project structure.

Our current structure has a single Source Control, with many Projects. Those source control "projects" may contain multiple folders which contain multiple Visual Studio Solutions which can contain multiple Visual Studio Projects, some of which are shared.
An example:

  • Main Directory
    • Folder 1
      • Solution 1
        • Project 1
        • Shared Project 1
    • Folder 2
      • Solution 2
        • Project 2
        • Project 3
      • Solution 3
        • Project 4
        • Shared Project 1
        • Shared Project 2
    • Folder 3
      • Solution 4
        • Shared Project 1
        • Shared Project 2

I am not sure at all how to translate this to git properly. The main concern that has been mentioned to me is that if we use git submodules, when checking in changes it has to be applied to multiple repositories. Is there a way around this? Does TFS in Visual Studio handle this in an easy to manage way?
Anyone have any good information about this kind of thing?

3 Answers 3

3

It depends on how closely coupled the modules are. And mainly how closely coupled they are in organizational terms.

All modules developed by the same team in context of the same project (in management sense of the word) should probably go in one repository, especially if it's possible that a logical change will span more than one of them.

Modules that are developed separately, they should live in separate repositories. But than there should also be at least semi-formal release process for providing the results of one project to the other. Not because of git but to reduce communication overhead especially when a bad commit in one project would affect many people in other projects.

Git will happily work with hundreds of thousands of files. It will work if you split or if you don't. So the decision to split is organizational. You want some barrier between teams so mistakes don't affect too many people and you want reasonably small teams to limit the communication overhead (20 people is rather large team).

1

TFS treats everything as a single repo, so you can't do much harm starting with all stuff in a single git repo retaining the previous structure. Or splitting off only the obviously disjunct elements.

You can split the big repo with subtree after-the fact anytime preserving the history.

Having a single repo has many actual advantages and unless clone size is considered relevant the drawbacks are easy to mitigate.

If you start with multiple repos you immediately need some tool to sync them all for fetch and tag all on release points. Also moving code around is inconvenient (from app to shared lib, should be common and straightforward).

Sure you may fight your way with submodules, or something similar but many folks find those kept as last resort.

We moved from tfs to git a year and a half ago, I created a bin repo for external components, one for "data", and kept all the sources that are built with VS in one repo. Only splitting the fortran sources on which one programmer is working and he has a bin repo to release the output -- that supplements the bin repo. And I immediately wrote a tool in python that knows about all the repos (we also have installer, tests, tools, etc) and allows basic operations (fetch, status, synch), and more importantly, that "creates" the development environment copying the external includes, libs, dlls...

The source repo has some 1.6M lines of code in ~4000 files and ~90 projects. I have no plans to split it. The bin and data repos are fortunately quite cold. Still a few times it was PITA to go back with sources and need to manually go back with others too bisecting a problem.

0

Ah, the old "shared projects".. for those who don't use TFS (or VSS) you can create a kind of symlink inside your repo so a single project appears to be in 2 places at once. This is what is being used here.

To my knowledge, no other SCM has this feature. IMHO this is a good thing as it makes you think of each project as an independent entity and not mix it up inside projects - I think its only really usefulness is if your IDE doesn't handle external references well...

So, if you want to migrate away, you're going to have to split these shared projects into a different project structure, and build them separately. then change your projects so they build with references to the sub-projects. Do not try to keep the same mind-set of keeping these projects in the existing tree/solution structure. Your solutions will not be able to contain all the projects within them. MS has some guidelines for organising your SCM, you'll have to move from the 'partitioned solution' model to the 'multiple solutions' model.

you'll have to manage dependencies between the projects, but that's not so hard if you have a good CI system that will build a chain of dependencies when 1 changes (I recommend Jenkins, its as powerful yet much simpler than the unmaintainable xaml-based build TFS2012 now uses)

1
  • 2
    SVN has externals, git and HG have subrepos which are alot like these symlinks I think. Commented Mar 29, 2013 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.