0.1.0 • Published 7 years ago
zflow v0.1.0
zflow
分支命名
next分支:下一版将上线的分支,不在下一版上线的功能不要合并到此分支。feature分支先合并到此分支,解决掉冲突,供测试人员、产品经理测试通过后,准备上线。preview分支:预览分支,不在下一版上线的功能发布到这个分支供产品经理预览。这个分支不会合并到master分支,可以随便玩,坏了就 reset 到next分支状态。master分支:主分支,hotfix和feature分支都从此分支 checkout 出来。vMAJOR.MINOR分支: 版本分支,比如 v0.1、v2.0。feature/*分支: 功能分支,在此分支上开发新功能。hotfix/*分支: bug修复分支,在此分支上修复bug。
新功能开发
- 创建新功能分支
yarn zflow create feature <name>开发
完成新功能分支
yarn zflow finish feature [names..]- 预发布
yarn zflow preprelease next- 发布
yarn zflow release nextBug修复
- 创建bug修复分支
yarn zflow create hotfix <name>修复
完成bug修复分支
yarn zflow finish hotfix [names..]- 预发布
yarn zflow preprelease hotfix- 发布
yarn zflow release hotfixCLI
create
yarn zflow create <type> <name>type:
- feature: 创建
feature分支 - hotfix: 创建
hotfix分支
执行操作:
git checkout master
git checkout -b <type>/<name>
git push -u origin <type>/<name>finish
yarn zflow finish <type> [names...] [--temp]type:
- current: 合并当前所在分支(
feature或next)至next分支 - feature: 合并
feature分支至next分支 - hotfix: 合并
hotfix分支至vMAJOR.MINOR分支、next分支和master分支
temp: 仅合并 hotfix 分支至 vMAJOR.MINOR 分支(临时修复,不合入下一个版本)
执行操作:
# targetBranch = type === 'next' ? 'next' : 'latest'
# newVersion = type === 'next' ? 'minor' : 'patch'
git push
zflow checkout <targetBranch>
git pull
git merge [names...] -m "Merge [names...] into <targetBranch>"
git push
# only if type is hotfix and without option temp, following commands will be executed
git checkout master
git pull
git merge [names...] -m "Merge [names...] into master"
git push
git checkout next
git pull
git merge master -m "Merge master into next"
git pushprerelease
yarn zflow prerelease <type>type:
- next: 发布
next分支至灰度环境 - hotfix: 发布
vMAJOR.MINOR分支至灰度环境
执行操作:
# targetBranch = type === 'next' ? 'next' : 'latest'
# newVersion = firstTimePrerelease ? 'prerelease' : type === 'next' ? 'preminor' : 'prepatch'
zflow checkout <targetBranch>
git pull
npm version <newVersion>
git push
git push --tagsrelease
yarn zflow release <type>type:
- next: 发布
next分支至生产环境 - hotfix: 发布
vMAJOR.MINOR分支至生产环境
执行操作:
# targetBranch = type === 'next' ? 'next' : 'latest'
# newVersion = type === 'next' ? 'minor' : 'patch'
zflow checkout <targetBranch>
git pull
npm version <newVersion>
git push
git push --tags
# only if type is next, following commands will be executed
# latestVersion is generated from version in package.json
git checkout master
git pull
git merge next -m "Merge next into master"
git push
git checkout -b <latestVersion>
git push -u origin <latestVersion>0.1.0
7 years ago