AgentSkillsCN

gitflow-changesets-releases

遵循 GitFlow 与 Changesets 结合的分支、版本控制与发布流程。适用于以下场景:(1) 创建或合并功能分支、发布分支或热修复分支;(2) 编写常规提交;(3) 添加或版本化 Changesets;(4) 在 PR 或发布前运行测试;(5) 当用户询问关于发布、变更日志、分支管理或 GitFlow 时使用。

SKILL.md
--- frontmatter
name: gitflow-changesets-releases
description: Follow Gitflow with Changesets for branching, versioning, and releases. Use when (1) creating or merging feature, release, or hotfix branches, (2) writing conventional commits, (3) adding or versioning changesets, (4) running tests before PR or release, or (5) the user asks about releases, changelog, branching, or gitflow.

Git, Changesets and Versioning Workflow

Gitflow with Changesets for version management and releases. Branches: main (production), develop (integration), feat/* / fix/* (from develop), release/* (to main), hotfix/* (from main).

Branch Model

BranchPurposeCreated FromMerged To
mainProduction-release/*, hotfix/*
developIntegrationmainfeat/*, fix/*
feat/*New featuresdevelopdevelop
fix/*Bug fixesdevelopdevelop
release/*Release preparationdevelopmain, develop
hotfix/*Critical prod fixesmainmain, develop

Quick Workflows

Feature

Branch from develop → commit (conventional commits) → run pnpm build && pnpm test:e2epnpm changeset → commit changeset → push → PR to develop.

bash
git checkout develop && git pull && git checkout -b feat/my-feature
# ... make changes, commit ...
pnpm build && pnpm test:e2e
pnpm changeset
git add .changeset/ && git commit -m "chore: add changeset"
git push -u origin feat/my-feature

Release

From develop: create release/vX.Y.Zpnpm changeset:version → commit → run tests → merge to main → tag → back-merge to develop.

bash
git checkout develop && git pull && git checkout -b release/v1.1.0
pnpm changeset:version
git add package.json CHANGELOG.md .changeset/ pnpm-workspace.yaml && git commit -m "chore: release v1.1.0"
pnpm build && pnpm test:e2e
git checkout main && git pull && git merge --no-ff release/v1.1.0
git tag -a v1.1.0 -m "Release v1.1.0" && git push origin main --tags
git checkout develop && git merge --no-ff release/v1.1.0 && git push origin develop

Hotfix

From main: create hotfix/name → fix → pnpm changeset (patch) → pnpm changeset:version → run tests → merge to main → tag → back-merge to develop.

bash
git checkout main && git pull && git checkout -b hotfix/critical-bug
# fix, then:
git commit -am "fix(scope): fix critical bug"
pnpm changeset
pnpm changeset:version
git add package.json CHANGELOG.md .changeset/ && git commit -m "chore: bump version for hotfix"
pnpm build && pnpm test:e2e
git checkout main && git merge --no-ff hotfix/critical-bug
git tag -a v1.1.1 -m "Hotfix v1.1.1" && git push origin main --tags
git checkout develop && git merge --no-ff hotfix/critical-bug && git push origin develop

Testing

Run before opening a PR and before merging release/hotfix to main:

bash
pnpm build
pnpm test:e2e

Version Bumps

Change typeBumpExample
Breaking changesmajor1.0.0 → 2.0.0
New featuresminor1.0.0 → 1.1.0
Bug fixespatch1.0.0 → 1.0.1

References

Load when needed for detailed steps, prompts, or troubleshooting: