Contributing using git

This page is intended at detailing the flow of contribution. Git is sometimes a complicated flow thus we detail here some processes that can be useful when contributing.

How to contribute?

All contributions must be done on your own fork of one of the OwnTech repositories, then filling a merge request. Here is a step-by-step guide for this procedure.

1. Forking an OwnTech repository

First, you need to fork the repository you want to contribute in. To do so, use you favorite git manager such as GitLab or GitHub and import the existing repository you want to contribute to (either Core or a Library repository).

2. Preparing your local repository

You can then clone your personal repository locally, and work in it. However, do not work in the main branch: create a branch of your own to include your contributions. This way of doing ensures that, if the main branch of the original repository is updated while you're working on your contributions, your personal repository will not be out-of-sync.

Example:

git clone https://path/to/your/forked/repo.git my_forked_repo
cd my_forked_repo
git branch my_branch

It is also advised to add the original OwnTech repository to your remotes so that you can sync your repository with the root.

Example for the Core repository:

git remote add owntech https://gitlab.laas.fr/owntech/power-api/core.git
git pull owntech main

3. Pushing the changes

When you're satisfied with your change and want to contribute it to the main repository, first check if there has been commits made to the main branch ahead of your branch root. If so, cherry-pick any such commit to your branch to make sure the merge does not introduce conflicts.

Then, push your branch to your own repository.

Example, assuming your online repository is registered as origin in your local repository:

git push origin my_branch

Finally, fill a merge request in GitLab for your branch into OwnTech's main branch.