# Hotfix Workflow {#hotfix-workflow}


Emergency fix process for production issues.


## When to Use {#when-to-use}


- Critical production bug affecting users
- Security vulnerability discovered
- Data integrity issue


## Process {#process}






```mermaid
graph LR
    Detect[Detect Issue] --> Branch[Hotfix Branch from main]
    Branch --> Fix[Implement Fix]
    Fix --> Test[Fast Test]
    Test --> PR[PR to main]
    PR --> Deploy[Deploy to Prod]
    Deploy --> Backport[Merge to develop]
```






## Steps {#steps}



### 1. Create Hotfix Branch {#1-create-hotfix-branch}


```bash
git checkout main
git pull
git checkout -b hotfix/issue-description
```


### 2. Implement Fix {#2-implement-fix}


- Focus on the minimal fix only
- No refactoring or feature additions
- Add a regression test


### 3. Test {#3-test}


```bash
yarn test
yarn test:e2e  # if time permits
```


### 4. Deploy {#4-deploy}


```bash
# Fast-track PR review
# Merge to main
# CI/CD auto-deploys to production
```


### 5. Backport {#5-backport}


```bash
git checkout develop
git merge hotfix/issue-description
git push
```


### 6. Post-Mortem {#6-post-mortem}


| Item       | Detail                     |
| ---------- | -------------------------- |
| Root cause | Why did this happen?       |
| Detection  | How was it found?          |
| Impact     | How many users affected?   |
| Fix        | What was changed?          |
| Prevention | How to prevent recurrence? |


## Related Pages {#related-pages}


- [Release Management](https://sourcey-gauzy.pages.dev/workflows/release-management/index.md) — releases
- [Incident Response](https://sourcey-gauzy.pages.dev/workflows/incident-response/index.md) — incident handling
- [Git Workflow](https://sourcey-gauzy.pages.dev/development/git-workflow/index.md) — branching
