1

I have a .NET solution - let´s call it bookshop, that contains multiple project: bookshop.web, bookshop.lib.

The bookshop.web is a web-application that display the content to the user. Bookshop.lib is a library that contains plenty of javascript code. The javascript code will be concated (with Gulp) to a single file with a release version number.

When I work with the solution I often change in both web and lib, and find parts of javascript code in the concatenated lib file that should not be in that particular version. We use Git and branches in our project, but the branch involves changes in both web and lib, so it is hard to separate it to only the javascript version.

Is there a way to have my solution in a Git repository, but have a branch that only affects the lib folder - and a branch that only can change the web? I want to be able to switch lib branches depending on it´s release version, without having to change the web branch.

Any advice on this working progress problem would be great.

Olof84
  • 919
  • 4
  • 14
  • 29
  • 1
    Sounds you probably need multiple repositories. One for the lib, one for the rest of the code, so you can swap them independently. – VLAZ Jul 02 '19 at 07:12
  • Yeah, but can a .NET solution have two repositories? – Olof84 Jul 02 '19 at 07:16
  • Why not? It will have to depend on how exactly you manage your dependencies, of course, but *in general*, for many languages you can have some build artefact you depend on. So you can think of your system composed of different components - one is the lib, the other is the web application. Web application depends on lib, so you would produce some sort of artefact of the lib, then include it in the web project. This can be automated if you lib artefact is put in an internal or external repository for dependencies and the web project pulls from there. – VLAZ Jul 02 '19 at 07:21

1 Answers1

0

Like explained in this topic, there's a feature in git called submodule to handle nested git repositories. I think it's the way you should take.

Another useful link ! Good read :)

Saitama
  • 103
  • 1
  • 9
  • Can submodules have their own branches? I want to be able to switch between different branches of the lib project, when developing it. – Olof84 Jul 02 '19 at 10:40