M
M
Michael2016-09-26 20:38:54
git
Michael, 2016-09-26 20:38:54

How to start using git submodules?

The project uses git in the main repository /project and /project/code/vendor/sub-repo.
Recently I learned that you can make submodules https://git-scm.com/book/en/v1/%D0%98%D0%BD%D1%81%...
There were a couple of questions.
1. Can I add a link to an existing submodule?
`repo` already exists in the index
2. Did I understand correctly that in the future it will be possible not to worry about deploying a dozen repositories, but only install the base one, and the rest will be installed by themselves?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
homocomputeris, 2016-10-01
@springimport

The easiest way is to remove the directory from the index and initialize the submodule in its place. I don't know how this works with subsubfolders, but directly editing the .gitmodules modules file might work:

[submodule "sub-repo"]
  path = project/code/vendor/sub-repo
  url = https://project/code/vendor/sub-repo

Yes, then it will be possible to pull everything at once and even in several streams.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question