flowchart TD
  Start([Defect found])
  Q{Affects released code\non master / latest tag?}

  Start --> Q
  Q -->|Yes| A[Branch hotfix/* from master]
  A --> B[Fix + tests]
  B --> C[Merge to master]
  C --> D[Tag patch on master e.g. v0.1.3]
  D --> E[Merge master into next]
  E --> End([Done])

  Q -->|No, only on next| F[Branch fix/* from next]
  F --> G[Fix + tests]
  G --> H[Merge to next only]
  H --> End2([Ships with next release])

  style C fill:#c8e6c9
  style D fill:#c8e6c9
  style E fill:#bbdefb
  style H fill:#bbdefb
