|
|
How to use submodules
|
|
|
--------------------
|
|
|
|
|
|
If you would like to set up a repository that makes use of some code or other content that is contained in another repository on OpenVT or a different git server, the Git submodule structure is a handy tool that allows automatically synchronising and pulling the content from the secondary repository.
|
|
|
|
|
|
Getting started
|
|
|
----------------
|
|
|
* Start a Project on OpenVT, let's say the name is **my_awesome_project.** You would like to include some other repository in there, let's say that one is called **the_other_awesome_project** (that one can be located on OpenVT or any other git server).
|
|
|
* Make a clone on your computer with git:
|
|
|
```bash
|
|
|
git clone <cloning_link_for_my_awesome_project>
|
|
|
```
|
|
|
* Now browse into the folder of the clone and add the other repository as submodule:
|
|
|
```bash
|
|
|
git submodule add <cloning_link_for_other_awesome_project>
|
|
|
```
|
|
|
That will eventually prompt you for your access credentials to the other project and clone the contents into a subdirectory of the same name.
|
|
|
* If you would like to update the content of the submodule, do
|
|
|
```bash
|
|
|
git submodule update
|
|
|
```
|
|
|
* If you clone a repository which already contains a submodule, cloning the main repository creates an empty folder for the submodule. You have to separately pull the submodules. After cloning, browse into the folder of the clone and do:
|
|
|
```bash
|
|
|
git submodule init
|
|
|
git submodule update
|
|
|
```
|
|
|
|
|
|
For more information on submodules, please refer to the [Git manual](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
|
|
|
|
|
|
|