How to separate a small library from a large Git tree

There is a small library in some large project (in the git repository), which, it seems to me, can be taken into account from this large project, and therefore it is useful for people who need only a small library.

A small library is a subdirectory in a large project.

What is the best way to do this? In particular, I ask how not to lose touch with the parent project, so I can:

  • save story
  • benefits of improvements up,
  • contribute to improvements in the upstream,
  • (and, of course, I can still make small changes, I need the library to be separated from the large project structure)

I was thinking of just expanding and then moving and deleting elements with git, but I'm not sure if it will keep sufficient connections with the parent project.

+4
source share
2 answers

and then moving and deleting elements with git, but I'm not sure if it will keep sufficient connections with the parent project.

Once you do this, you still need to declare this new repo (for a small library) as a submodule in your large project repo (see ). git submodule

Thus, you will precisely refer to a specific version of this repo library and still be able to contribute to this library (see the " true nature of submodules ").

+3
source

git, :

  • → , upstreem,
  • → , git
  • → , git push
  • : upstream → can,

, , , , .

+3

All Articles