Linking 2 repositories

Let’s say I have a repository named A, and a repository named B. Is there a way to link those repositories so that B will appear to be a folder inside A and if I push to B, A also updates?

Hi there. 👋

There is, they’re called submodules, they have some similar commands as regular git like add, status and such, but are prefixed with the submodule command, I wrote a blog post about how I learned about them, but I highly recommend reading the documentation

Hope that helped a bit. :slightly_smiling_face:

1 Like

Sort of, you could create a submodule from B in A. However, A will not automatically update: The submodule entry stores a specific commit.

To update A you have to update the submodule (go into the submodule directory and pull or merge as usual), and then commit the change to the submodule commit in A.

See: https://git-scm.com/docs/gitsubmodules

1 Like