How to use git with this project.
To know how to develop in this project, go here.
There are 2 main branches on which modifications are (normally) not directly applied:
- master: Represents a stable production state:
All the code works and provides a functional solution. - develop: Usually before merging on master:
A functional code on which is added a set of new features to be tested for validation.
When can master or develop be modified ?
These branches should never be modified directly (see Merge/Pull Request).But it can be done if the following conditions are true:
- All members are aware of the changes and have agreed to them.
- The changes are ridiculously small (or they are not really developed features).
- They are made on a critical time or to test infrastructure.
Here's some examples:
- The CI has just been set on a production server. The change: increase timeout
- An update of an infrastructure needs to change some parameters. The change: update configuration/environment values
To develop, use the dev/
branch directory.
It is also the feature directory.
These work branches are followed by a meaningful name or nominal group.
Examples:
dev/back/login
: implementation of the login in the backend code.dev/common/create-dtos
: Creations of common _DTO_sdev/update-id
: Change the type of entity IDs fromstring
tonumber
If using a 3rd party project management, such as Jira, It could be more efficient to add the Issue/task ID in the branch name.
If a feature has already been merged and a fix is needed, use fix/
subdirectory.
The naming is the same as the one for work branches.
Examples:
fix/office/login
fix/update-id
These branches can also be created from the post-development testing process.
Use the doc/
directory when the documentation is created or modified.
Examples:
doc/how-to-test
doc/back/migration
Except for the previous reserved names feel free to use other names for other kind of modification.
Examples:
infra/ci
: Update of the CI processinfra/docker
: Add some docker filesinit/worker
: Add a new Nx Library
As the branches are deleted once merged, the naming is not that important.
But to keep thing clean and usable (notably on some Git editors) use existing branch directories (e.g. already adocumentation/bla
branch) or add reserved names to this documentation.
Use commitizen:
npx cz
The scope can be freely chosen.
Warning:
Do not use afix
type for something that is not yet merged (on "your" working branch).Example:
- A new feature is implemented:
feat(login): can login
- Then, even before it is ready to merge, a bug is fixed
chore(login): do not return the sent password on login
Keep in mind that the
fix
type will appear in the CHANGELOG.
It would be strange if aBug fixes
section appears for a bug that never occurred.
This section describe how to create/review/approve/... a Merge Request or Pull Request (or whatever is used).
PR (Pull Request) will be used to reference this.
When creating a PR, use a meaningful title and add the issue(s) in the description. More information can be added in the description if necessary:
- Errors encountered (for the reviewer)
- Important change (not related to the current feature)
- New utility added (class/function)
No real constraints here except to be humble when reviewing;
Nobody's always true, anybody can still be wrong.
- All CI tests must succeed.
- The styleguide must be respected.
- The code is up-to-date.
- (There's tests for the added feature(s))
What is the styleguide applied?
See here.
To merge a PR, all conversations must be resolved and approved by at least one other person.
A PR can be verbally approved (live review), so it can be auto-approved with the given message
approved verbaly by <user.name>
.
There is no answer to this here. It is up to the team (or the reviewers of a PR) to define it.
Keep in mind that a squash leaves a cleaner history, but removes information about it.
It also can generate an incomplete CHANGELOG.
After merging, the branch must be deleted.
In which case, manual tests must be performed on the server(s).
If an error is found, then the merge is revert or a fix branch is created.
The purpose of these manual tests is to ensure that the deployment worked and that no obvious errors occur.