Git workflow

Important

If you need any help on this or any other topic, remember you can ask on the #help channel on Teams. Your colleagues are here to help!

We use a simplified version of this widespread workflow.

We have a master branch, with only stable code that has passed merge requests and pipelines. If the project is mature enough, we have two base branches:

  • master, with the production code

  • develop, with code stable enough but that hasn’t been released yet

Every new bug fix or every new feature has to be pushed on a branch called feature/something, and then a MR against develop (if available) or master has to be created.

If there is a critical bug fix that has to go to production as soon as possible, push to a branch called hotfix/something and then create a merge request against master. When merged, merge again master over develop.

In data science projects where many models have to be tested, we use separated branches called model/model_class for each model. When a new model is sufficiently mature and improves the performances of the current model on develop (if available) or master, a MR against develop (if available) or master has to be created.

Scope of a branch

To make the merge request process fast and easy, try to make every branch as small as possible.

Also, instead of creating a new branch from existing branches, try creating it from develop (if available) or master. Let’s suppose you fix two issues, and create feature/fix-1 and feature/fix-2: if the latter is based on the former, then it cannot be merged until the first has been merged: if the second requires no work, and the first on the other hand has a long review process, you have a perfect valid fix that waits to be deployed for no real reason. The best way to act is basing both of them on develop, if possible, so their MR are independent one from another.

Owner of a branch

Be polite, do not push to others developers’ branches without their permission. If you want to propose an improvement, create a new branch from the one you want to improve, and then create a merge request against it, assignin it to the original author.