Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have two different submodules depending on git branch?

My company (consultancy) is developing for another company (customer). The two main engineers on the project for the consultancy (lead iOS and lead Android) have login capabilities for the customers git for maintenance of the source code. Besides that we (consultancy) have an internal git setup for our developers to use.

To manage the internal work done it is committed to the internal git and tested and merged by one of the leads to the customers git to release source code to the client.

One project we are working on requires the use of a library which is submodule, managed by another consultancy for the customer. Our two main developers have access to this submodule as we have access to the customers git repo.

Is it possible to create a local version of the submodule on our local git for access by our other developers and maintain the git-submodule address on the external git repo?

like image 502
Luke Avatar asked Oct 19 '25 09:10

Luke


1 Answers

Is it possible to create a local version of the submodule on our local git for access by our other developers and maintain the git-submodule address on the external git repo?

This is one of the reasons why to use submodules. git submodule is a standalone git repo contained in another git repo.


From the doc:

Submodules allow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit.


As explained above the submodule content is fetched form a standalone repository to a folder inside your current repository. Any modification to the submodule folder will not appear in the root folder git status on the root folder will not display them.

So to summarize it: submodule is exactly what you need here.

enter image description here

like image 198
CodeWizard Avatar answered Oct 21 '25 23:10

CodeWizard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!