Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Design a strategy for scaling and optimizing a Git repository, including Scalar and cross-repository sharing

A worked example

Yes or no

At Contoso, a platform team maintains a shared logging library in its own Git repository in Azure Repos. Three product teams each work in their own separate repository and want to reuse the logging library. Management requires that every team keeps its own repository; the repositories must not be merged.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.

StatementYesNo
Adding the logging library's repository as a Git submodule places the library as a folder inside each product team's repository.

A submodule embeds a separate Git repository in a parent repository, where it appears as a folder. Each product repository therefore gets the library as a folder, and all the repositories remain separate, as management requires.

Correct
When a product team adds the library as a submodule, Git records the submodule's URL in a file named .gitignore.

Adding a submodule makes Git write the submodule's details, including its URL, to a text file named .gitmodules. The .gitignore file is not where Git stores this information.

Correct
Publishing the logging library to a centralized package registry lets the product teams consume it as a shared dependency consistently across their projects.

The cross-repository sharing guidance recommends a central package registry or artifact store. The platform team publishes the shared library there once, and every project consumes the same dependency in a uniform way, while each team keeps its own repository.

Correct
Why

The teams must keep separate repositories, so they need a cross-repository sharing mechanism rather than consolidation. A Git submodule brings the shared library's repository into each consuming repository as a folder. Git keeps the submodule's details, including its URL, in a .gitmodules file, not in .gitignore. As an alternative, the platform team can publish the library to a central package registry so that every project consumes the same shared dependency consistently.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free