# Gitflow

## Protecting branches

Protected branches prevent anyone to push on the selected branch, the only way to add code to the branch will be using merge requests.

### Setting Development Branch

- Retrieve the project on your computer, open a command line and execute.

```sh
git clone https://forge.grandlyon.com/web-et-numerique/factory/llle_project/ecolyo
```

## Start Developing

### Branch naming

:warning: to be updated with the changes of Factory

In our team organisation we are using Icescrum to keep track of our User Stories (US). Each US is identified by a number. In order to easily identify the commit that refers to the US, a `feature` branch name should follow this structure:

- _feat/USXX-<title_of_the_user_story\>_

You can create the branch by typing:

```sh
git checkout -b feat/USXX-<title_of_the_user_story>
```

> Note that the **feat** type is the only one with a dedicated folder (feat/-US).

Each fix branch should be named as the following _fix/<title_of_the_fix\>_.

You can create the branch by typing:

```sh
git checkout -b fix/-<title_of_the_fix>
```


### Conventional commit

The [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/#summary) is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.

The commit message should be structured as follows:

```
<type>[optional scope]: <description>

[optional body]

[optional footer(s)]
```

The commit contains the following structural elements, to communicate intent to the consumers of your library:

* **fix**: a commit of the type fix patches a bug in your codebase (this correlates with PATCH in Semantic Versioning).
* **feat**: a commit of the type feat introduces a new feature to the codebase (this correlates with MINOR in Semantic Versioning).
* **BREAKING CHANGE**: a commit that has a footer BREAKING CHANGE:, or appends a `!` after the type/scope, introduces a breaking change (correlating with MAJOR in Semantic Versioning). Give a solid description of the changes as well.
* types other than fix: and feat: are allowed, for example @commitlint/config-conventional (based on the the Angular convention) recommends `build:`, `chore:`, `ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`, and others.
* footers other than BREAKING CHANGE: <description> may be provided and follow a convention similar to git trailer format.


## Gitflow Scheme

![Gitflow](/img/gitflow.png)