Create a hotfix branch to patch a published release when main has unreleased work. Use when the user needs to fix a bug in a published version.
Use this when a bug is found in a published version and main has unreleased work that shouldn't ship yet.
1.2.0) and users are on that version.main has commits after that tag with unreleased feature work.1.2.1) without including the unreleased work.If main has no unreleased work beyond the last tag, skip this — just fix on main and use /release.
git fetch --tags
git checkout -b hotfix/X.Y.Z <release-tag-to-fix>
Example: git checkout -b hotfix/1.2.1 1.2.0
## Unreleased, write the version section directly in CHANGELOG.md:## 1.2.1 - YYYY-MM-DD
- Fix: description of the bug fix
Copy the new version section into RELEASE_NOTES.md, replacing its contents.
git add -A && git commit -m "Release X.Y.Z"
git push -u origin hotfix/X.Y.Z
git tag X.Y.Z && git push --tags
GitHub Actions will build and publish from the tag.
git checkout main
git cherry-pick <hotfix-commit-hash>
If the cherry-pick conflicts, resolve manually. Make sure the fix ends up under ## Unreleased in main's CHANGELOG.md (it may need rewording since main's Unreleased section is different).
git branch -d hotfix/X.Y.Z
git push origin --delete hotfix/X.Y.Z