Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing Internal Shared Libraries with Git and Nuget

I have just started splitting up our Git repository that houses all of our product code, which includes shared libraries, server, client, and tooling code.

As a part of removing some of the tech-debt we have with our DCVS, we are proposing moving our shared client, and server libraries to a Nuget archive that will have tightly controlled push permissions on the development and release branches to force facilitation of pull requests that we have been slack with. The splitting part is no big deal; I have tailored git filter-branch to my liking with respect to history retainment, and am now looking at how to stitch repositories back together.

At the moment, the libraries are not entirely clear-cut and need some heavy refactoring before I am ready to package them up (as well as proper unit testing, and the like) and would like to be able to make changes to both repositories, with an emphasis on code review, as a short to medium term solution.

I have read enough about both git subtree and git submodule to understand their relative strengths and weaknesses, but am still conflicted about what to do. While an overwhelming number of resources protest against using git submodule due to its fragility to those unknowing of how to use it (guilty!), it's alternative git subtree seems to lack that explicit referencing features I am looking for.

If anyone has a similar setup to what I am looking for, or has a similar workflow done differently, could you comment on it? I am going to go away and test the two strategies while I "wait for a bite", and will hopefully have a more elevated assessment.

like image 382
Daniel Park Avatar asked Aug 02 '14 03:08

Daniel Park


1 Answers

We recently moved to Git from a more traditional version control system. Long before I started we had adopted the habit of checking libraries into the version control. Obviously this does not work well in Git, nor was it a good idea in the other VC. So we ran into a similar set of choices to yours. After reviewing subtrees and submodules we have decided to use neither. We have multiple repositories that are cloned as peers:

  <some folder>
             |
             + <repo1>
             |
             + <repo2>
             |
             + <repo3>
             |
             + <packages>

We also use Nuget to handle our libs (note we are developing in C and C++ not .Net). Nuget works well enough for native libraries and we have not found an alternative. The process is much more manual than I would like, but it does avoid a whole set of "interesting" issues that seem to plague both submodule and subtree.

Hope that helps.

like image 108
Patrick O'Hara Avatar answered Nov 04 '22 12:11

Patrick O'Hara