What are the best practices for putting a common library in multiple git repositories?

Asked 1 years ago, Updated 1 years ago, 44 views

For example, there is a common library in the git repository called A and B.
Suppose you have a requirement to manage it in one source with symbolic links.
Example Directory

A/.git
 /lib->../lib
B/.git
 /lib->../lib
lib/

However, if you commit with A and B in such a case, symbolic links will be treated as files, so when you push further from there, you will not be able to push the file below lib.

For example, if you separate the servers between the app server and the management screen server and use the same source in some places, I would like to know the best solution for this situation.

git

2022-09-30 20:34

2 Answers

One source management of a common library over symbolic links seems a little strange.

A common solution is to use the git submodule.

In this case, A and B libraries must be managed in a separate repository, so you may feel the difference from the requirements, but since they are originally independent projects and libraries, I think they should be managed in a separate repository.

The common library (or resources) is so huge that it's a few gigabytes that you can't handle if you're having trouble eating up the capacity of your hard drive.

I think the following site will be helpful.
http://qiita.com/sotarok/items/0d525e568a6088f6f6bb


2022-09-30 20:34

I often use it with software similar to package management tools.

For example, Node.js uses a management tool called npm.
Write a library that depends on the file package.json, clone it, and retrieve it using the tool command (npm install).

Ruby has Gem, C# and NuGet for VB.NET, and standard package management tools in many languages, so you might want to check them out.


2022-09-30 20:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.