2

I am moving my companys source control from TFS to GIT. We have TFS currently defined as.

  • Project Collection /
    • / Client A
      • / Product A
      • / Product B
      • / Product C
    • / Client B
      • / Product D
      • / Product E
      • / Product F

What is the best way to do this in Git? I have thought about the following:

  • Repository (Client A)
    • Branch (Product A)
    • Branch (Product B)
    • Branch (Product C)
  • Repository (Client B)
    • Branch (Product D)
    • Branch (Product E)
    • Branch (Product F)

What do you think is the best approach as the design is slightly different?

Rory Hunter
1,7479 silver badges15 bronze badges
asked Feb 6, 2014 at 10:44
1
  • 2
    Are the products distinct? If yes, why not create one git-repo per product? Commented Feb 6, 2014 at 11:15

2 Answers 2

12

You should create a new repo for each independent project. Why?

  • Someone working on project D does not have to download all the history for E and F.
  • Git repos are cheap to initialize, so you can use as many as you like.
  • It is painful to work with multiple projects at once when they are represented as branches in a repo: When switching from A to B to quickly look up something, you'd have to stash your uncommitted changes, then check out the the other branch (which would rewrite the complete directory structure, expensive for large projects), then check out the original branch again and apply your stashed changes. It's not generally possible to view the projects side-by-side without cloning the repo multiple times.
  • The history will be a mess. When using Git, one will sometimes work on multiple feature branches that get merged back in after a while. But when having a project per (main) branch, you'd have multiple parallel but absolutely unconnected branches. They share nothing, so why should they share the repo?

If a project depends on another project, you can use git submodules to connect the repos without having to put everything in a single repo.

answered Feb 6, 2014 at 11:26
0

At our company, we develop all source code from one large repository with individual folders for each client/product. Although clients each receive their own individualized software package, all our products have our expertise in common and we re-use much of our code. This re-use happens through shared libraries. Having all client projects in the same repository allows to fulfill all the necessary library dependencies.

Even if at this point in time all your software products are distinct and non-overlapping, code re-use and shared libraries may come in the future. This extension will be very easy in a single repository, but more intricate with multiple.

answered Jul 16, 2015 at 8:39

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.