Shared code across many (web) projects using git

I work in a small team that creates and maintains quite a lot (> 100) of ASP.NET website projects. Our current workflow is that our projects are all located on a network drive, which everyone works from directly. We have a couple of shared code libraries, which contain both binaries and css, js and xsl files. With each addition to this shared code, the files are distributed by copying them to all projects on the network drive using a script.

Our current project “layout” looks something like this:

Shared code project
   |- Deployment (compiled binaries)
   |- Library (C# source code)
   |- Web (a website project that contains the default css, js, etc)
       |- css
           |- default (shared css code)
       |- js
           |- default (shared js code)
       |- xsl ... etcetera

Website project
   |- Bin (shared code binaries)
   |- css
       |- default (shared css code)
       |- specific (project specific css)
   |- js
       |- default (shared js code)
       |- specific (project specific js)
   |- xsl ... etcetera.

I’m currently in the process of trying to get us to switch to using git and working locally on our own machines. I’ve got most potential issues covered, except for how to deal with the shared code. Obviously we can no longer use the copy & replace script if we’re all working locally. So something a bit more sophisticated will have to be put in its place.

If I was using SVN I might use svn externals to reference certain files in the shared code repositories. The nice thing with that is that I can pick just those files I need (no C# source code), and put it exactly where I need it to be. But with git that doesn’t really seem to be an option. I’ve been reading a lot about git submodules and subtrees, but neither seem to be the ideal candidate.

I have also considered using a package manager like NuGet or Bower, but is this really a good idea for first-party dependencies? For one, it would mean that everyone who would want to git clone a website project would have to have the package manager installed.

What would a typical git setup for a website project with “first party” dependencies be?

A few details that I think are relevant to the choice:

  • I only need one-way synchronizing. Changes to shared code are made in the shared code libraries. I don’t need to be able to push to shared code libraries from a project library.
  • The shared code libraries are updated and distributed relatively frequently; a few times per week at least.
  • Both shared code libraries and website projects will be git repositories.
  • I don’t want to pull in the C# source code for the shared binaries.

2

You could stand up your own, private NuGet package feed on an internal server in your company. Publish each dependency to your NuGet site as a separate package and use NuGet to manage those dependencies. Furthermore, if you need to make code changes to a package you can create a local package feed so you can change code, compile and update. When you are ready to share with coworkers, tag and push in Git, then publish to your company feed.

Hosting Your Own NuGet Feeds (NuGet Docs)

The nice thing about this approach is you get backwards compatibility with your packages. You can make API breaking changes without requiring other projects to be on the same release cycle as yours. As an added bonus project structures probably wouldn’t be affected if you change source control systems.

3

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật