2

Suppose you have a private git repository for your ambitious next-facebook project(A).

You find an awesome-but-need-modification github library(B) so you fork the repo.

How do you include the library(B) in your project git(A)?

as a submodule?

eugene
  • 36,347
  • 56
  • 224
  • 435

1 Answers1

1

You can use submodule if you want a source dependency between the two projects.
Your project will reference a fixed SHA1 of libraryB, but you can configure a submodule to follow a branch: see "Git submodules: Specify a branch/tag".

In that case:

cd /path/to/next-facebook 
git submodule add https://url/to/libraryB
git submodule update --init

This is different from subtree, where the history of libraryB would be part of your own project.

Community
  • 1
  • 1
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755