Skip to content

Repository Management

neitsa edited this page Dec 21, 2016 · 5 revisions

We use Git subtree commands to handle the RemoteTech-Complete repository as it is composed of the other repositories in the RemoteTechnologiesGroup organisation.

Adding a new subtree

First we need to add a remote for the subtree. The command is:

$ git remote add <friendly_name> <repo_url>

Example with RemoteTech-Common:

Neitsa@Falcon /RemoteTech-Complete (develop)
$ git remote add RemoteTech-Common https://github.com/RemoteTechnologiesGroup/RemoteTech-Common.git

Next add the subtree to RemoteTech-Complete. The command is:

$ git subtree add --prefix=<location> <friendly_name> <branch> --squash

Where:

  • <location> is the location of the subtree inside RemoteTech-Common
  • <friendly_name> is the name of the repository used in the previous step
  • <branch> is the branch from which to get the code
  • --squash: Always use this option to avoid polluting the history of the repository containing the subtree(s)

Example:

Neitsa@Falcon /RemoteTech-Complete (develop)
$ git subtree add --prefix=src/RemoteTech-Common RemoteTech-Common develop --squash
git fetch RemoteTech-Common develop
From https://github.com/RemoteTechnologiesGroup/RemoteTech-Common
* branch            develop    -> FETCH_HEAD
Added dir 'src/RemoteTech-Common'

Updating a subtree

If you need to update the subtree in RemoteTech-Complete, use the subtree pull command:

Neitsa@Falcon /RemoteTech-Complete (develop)
$ git subtree pull --prefix=<location> <friendly_name> <branch> --squash

Example:

Neitsa@Falcon /RemoteTech-Complete (develop)
$ git subtree pull --prefix=src/RemoteTech-Common RemoteTech-Common develop --squash

Updating the subtrees of the RemoteTech-Completerepository can be done with the scripts/update_subtrees.sh script in this repo. (see here

Clone this wiki locally