# branching

sequenceDiagram autonumber working branch->>main: Can I merge changes?

```
loop MERGE CONFLICTS
  main-->>working branch: Merge conflicts.
  working branch-->>main: Merge conflicts resolved.
end
Note right of working branch: Merge conflicts are addressed <br> before premerge check starts.

loop PREMERGE CHECK
  main->>main: Lint, Test (unit), Build.
  main-->>working branch: Premerge check failure.
  working branch-->>main: Premerge failures fixed.
end
Note right of working branch: Premerge checks <br> affected sources.

main->>main: Premerge success: Lint, Test (unit), Build / Deploy main.
Note left of main: On premerge success <br> all sources are checked.

loop RELEASE
  main->>release: Release functionality
  Note left of main: Each release release branch <br> gets overwritten with main.
  release->>release: Lint, Test (E2E, optional), Build / Deploy staging.
  release-->>main: Hotfix required.
  main-->>working branch: Hotfix required.
  working branch-->>working branch: I have a hotfix. Go to step 1.
end
```
