... | ... | @@ -2,6 +2,7 @@ |
|
|
title: Developer guide
|
|
|
---
|
|
|
|
|
|
|
|
|
# Table of contents
|
|
|
[[_TOC_]]
|
|
|
|
... | ... | @@ -12,30 +13,44 @@ All contributions are welcome. To start coding : |
|
|
- clone the repository
|
|
|
- use an existing branch or create one according to the [branching workflow](#Branching-workflow)
|
|
|
|
|
|
# Good practices
|
|
|
- **NEVER** `git add .` or `git add -A` or `git add -A .`
|
|
|
|
|
|
# Branching strategy : git-flow
|
|
|
source : https://nvie.com/posts/a-successful-git-branching-model/
|
|
|
|
|
|
## main branch
|
|
|
branch where the source code of `HEAD` always reflects a _production-ready_ state
|
|
|
## Permanent branches : main and develop
|
|
|
Main and develop are central to this workflow and are never deleted. They are where supporting branches will branch from during development.
|
|
|
|
|
|
### Main branch
|
|
|
Branch where the source code of `HEAD` always reflects a _production-ready_ state.
|
|
|
In theory, changes should never occur directly on main but should be developed on other branches (read below) and merged in main.
|
|
|
|
|
|
### Develop branch
|
|
|
Branch where the source code of `HEAD` always reflects a state with the latest delivered development changes for the next release, kind of an 'integration branch'.
|
|
|
|
|
|
## develop branch
|
|
|
branch where the source code of `HEAD` always reflects a state with the latest delivered development changes for the next release, kind of an '"integration branch'
|
|
|
## The supporting branches: release, hotfix and feature
|
|
|
### Release branches
|
|
|
|
|
|
> Release branches support preparation of a new production release. They allow for last-minute dotting of i’s and crossing t’s. Furthermore, they allow for minor bug fixes and preparing meta-data for a release (version number, build dates, etc.). By doing all of this work on a release branch, the develop branch is cleared to receive features for the next big release.
|
|
|
>
|
|
|
> The key moment to branch off a new release branch from develop is when develop (almost) reflects the desired state of the new release. At least all features that are targeted for the release-to-be-built must be merged in to develop at this point in time. All features targeted at future releases may not—they must wait until after the release branch is branched off.
|
|
|
>
|
|
|
> It is exactly at the start of a release branch that the upcoming release gets assigned a version number—not any earlier. Up until that moment, the develop branch reflected changes for the “next release”, but it is unclear whether that “next release” will eventually become 0.3 or 1.0, until the release branch is started. That decision is made on the start of the release branch and is carried out by the project’s rules on version number bumping.
|
|
|
> Source : https://nvie.com/posts/a-successful-git-branching-model/
|
|
|
|
|
|
## The supporting branches: release-* , hotfix-* and feature-*
|
|
|
### release branches
|
|
|
May branch off from:
|
|
|
`develop`
|
|
|
|
|
|
Must merge back into:
|
|
|
`develop` **and** `main`
|
|
|
`develop` **and** `main` simultaneously
|
|
|
|
|
|
Branch naming convention:
|
|
|
`release-*`
|
|
|
`release-vX.Y.Z` where X is the major version, Y is the minor version and Z is the patch version (see [Semantic versioning](#Semantic-versioning))
|
|
|
|
|
|
### Hotfix branches
|
|
|
> Hotfix branches are very much like release branches in that they are also meant to prepare for a new production release, albeit unplanned. They arise from the necessity to act immediately upon an undesired state of a live production version. When a critical bug in a production version must be resolved immediately, a hotfix branch may be branched off from the corresponding tag on the master branch that marks the production version.
|
|
|
>
|
|
|
> The essence is that work of team members (on the develop branch) can continue, while another person is preparing a quick production fix.
|
|
|
> Source : https://nvie.com/posts/a-successful-git-branching-model/
|
|
|
|
|
|
### hotfix branches
|
|
|
May branch off from:
|
|
|
`main`
|
|
|
|
... | ... | @@ -43,9 +58,13 @@ Must merge back into: |
|
|
`develop` and `main`
|
|
|
|
|
|
Branch naming convention:
|
|
|
`hotfix-*`
|
|
|
`<issue number>-hotfix-*` (automatically generated through the issue > create branch workflow, see [branching workflow](branching-workflow))
|
|
|
|
|
|
### Feature branches
|
|
|
> Feature branches are used to develop new features for the upcoming or a distant future release. When starting development of a feature, the target release in which this feature will be incorporated may well be unknown at that point. The essence of a feature branch is that it exists as long as the feature is in development, but will eventually be merged back into develop (to definitely add the new feature to the upcoming release) or discarded (in case of a disappointing experiment).
|
|
|
>
|
|
|
> Source : https://nvie.com/posts/a-successful-git-branching-model/
|
|
|
|
|
|
### feature branches
|
|
|
May branch off from:
|
|
|
`develop`
|
|
|
|
... | ... | @@ -53,7 +72,7 @@ Must merge back into: |
|
|
`develop`
|
|
|
|
|
|
Branch naming convention:
|
|
|
anything except `main`, `develop`, `release-*`, or `hotfix-*`
|
|
|
`<issue number>-feature-*` (automatically generated through the issue > create branch workflow, see [branching workflow](branching-workflow))
|
|
|
|
|
|
# Branching workflow
|
|
|
|
... | ... | @@ -62,19 +81,8 @@ This is the process to create a new branch. It is mandatory to first create an i |
|
|

|
|
|
|
|
|
Create an issue with a title containing one of the following keywords in square brackets as prefix :
|
|
|
| Type | Description |
|
|
|
|----------|--------------------------------------------------------------------------------------------------------------------------------------------|
|
|
|
| feature | new feature |
|
|
|
| fix | bug fix |
|
|
|
| chore | changes that do not relate to a fix or feature and don't modify src or test files (for example updating dependencies) |
|
|
|
| refactor | refactored code that neither fixes a bug nor adds a feature |
|
|
|
| docs | updates to documentation such as a the README or other markdown files |
|
|
|
| style | changes that do not affect the meaning of the code, likely related to code formatting such as white-space, missing semi-colons, and so on. |
|
|
|
| test | including new or correcting previous tests |
|
|
|
| perf | performance improvements |
|
|
|
| ci | continuous integration related |
|
|
|
| build | changes that affect the build system or external dependencies |
|
|
|
| revert | reverts a previous commit |
|
|
|
- feature (in a broad sense)
|
|
|
- hotfix (in a broad sense)
|
|
|
|
|
|
Example issue title :
|
|
|
|
... | ... | @@ -104,6 +112,21 @@ Valid branch names: |
|
|
## Commit rule
|
|
|
This rule exists to prevent cryptic commit messages, often pushed when in a rush and thus degrading the traceability of the commits in the repository's history.
|
|
|
|
|
|
Commits are first described by the type of their content, listed in the following table :
|
|
|
| Type | Description |
|
|
|
|----------|--------------------------------------------------------------------------------------------------------------------------------------------|
|
|
|
| feature | new feature |
|
|
|
| fix | bug fix |
|
|
|
| chore | changes that do not relate to a fix or feature and don't modify src or test files (for example updating dependencies) |
|
|
|
| refactor | refactored code that neither fixes a bug nor adds a feature |
|
|
|
| docs | updates to documentation such as a the README or other markdown files |
|
|
|
| style | changes that do not affect the meaning of the code, likely related to code formatting such as white-space, missing semi-colons, and so on. |
|
|
|
| test | including new or correcting previous tests |
|
|
|
| perf | performance improvements |
|
|
|
| ci | continuous integration related |
|
|
|
| build | changes that affect the build system or external dependencies |
|
|
|
| revert | reverts a previous commit |
|
|
|
|
|
|
A commit message should comprise the following :
|
|
|
- title line with 3 possibilities:
|
|
|
1. standard commit: commit type in square brackets (e.g. \[feature\] or any of the list of commit types) followed by the title, briefly describing the content : "[feature] Apply multiplying factor to GHI"
|
... | ... | @@ -113,7 +136,6 @@ A commit message should comprise the following : |
|
|
- commit message body
|
|
|
- possibly "Closes # \<issue number\>" but this is automatically handled in Gitlab merge requests
|
|
|
|
|
|
|
|
|
The commit message rule is set with the following regular expression:
|
|
|
|
|
|
`^(?:\[(feature|fix|chore|refactor|docs|style|test|perf|ci|build|revert)\] .+|Merge branch '.*' .+)\n\n(.+)`
|
... | ... | @@ -135,4 +157,7 @@ Describe the new feature, refer relevant commits, etc. |
|
|
### Merge remote branch into local branch
|
|
|
Merge branch '\<branch name\>' of gitlab.uliege.be:deal-public/branch into branch
|
|
|
|
|
|
Some description. |
|
|
\ No newline at end of file |
|
|
Some description.
|
|
|
|
|
|
# Good practices
|
|
|
- **NEVER** `git add .` or `git add -A` or `git add -A .` as it can create confusion when going back to a previous commit and hide meaningful changes in a heap of modified or newly created files |
|
|
\ No newline at end of file |