... | ... | @@ -9,10 +9,12 @@ In the following, a few hints how to get started with subtrees and how to perfor |
|
|
In case you prefer working with submodules instead, please check out the [Submodule section](https://openvt.eu/platform_manual_and_guidelines/manual_and_guidelines/-/wikis/Submodules). However, note that a submodule structure might not support pulling/pushing via SSL.
|
|
|
|
|
|
|
|
|
## How it works
|
|
|
##Cloning a repository with Subtrees
|
|
|
|
|
|
If you would like to clone a project containing a subtree, there is nothing special to do -- cloning the project automatically also clones the content of the subtree.
|
|
|
|
|
|
##Creating a Subtree
|
|
|
|
|
|
In case you would like to include a subtree into one of your projects -- e.g., you would like to include the vivaplus HBM into a project called my_project -- you have to create a subtree first. Browse into a folder on your computer containing a clone of my_project and do the following:
|
|
|
|
|
|
```bash
|
... | ... | @@ -20,6 +22,19 @@ git subtree add --prefix vivaplus <cloning_link_vivaplus> <branch_name> --squash |
|
|
```
|
|
|
This creates a subtree containing the branch <branch_name> in a folder called vivaplus (you can also change that name, just add the desired name after --prefix). The branch name is probably in most cases master -- but you can also use any other existing branch, or even a certain commit hash if you would like to point to a given commit. The option --squash only copies the latest version of the branch, without the history (if you leave it out, it comes with history, which makes the folder larger).
|
|
|
|
|
|
## Pulling and pushing to/from Subtrees
|
|
|
The content of the Subtree is essentially a copy of all contents of the linked
|
|
|
repository, but without the history. In case there were updates on the
|
|
|
repository, you might want to update the subtree. That is done with pulling,
|
|
|
just like you would do on a local clone of a repository, just the command is a
|
|
|
little bit more complicated:
|
|
|
```bash
|
|
|
git subtree pull --prefix vivaplus <cloning_link_vivaplus> <branch_name>
|
|
|
```
|
|
|
Pushing works in the same way, just replace 'pull' by 'push.' That means, you
|
|
|
can also push you changes to the linked repository back through the subtree.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
... | ... | |