git-flow 初探

2019-12-27  本文已影响0人  八喜_ne

安装git-flow 请自行搜索

-$ git flow init

Initialized empty Git repository in /Users/tobi/acme-website/.git/
Branch name for production releases: [master] 
Branch name for "next release" development: [develop] 

How to name your supporting branch prefixes?
Feature branches? [feature/] 
Release branches? [release/] 
Hotfix branches? [hotfix/] 

git-flow 模式会预设两个主分支在仓库中:

我们接下来进行创建开发功能的分支ne-demo,使用 \color{red} {git\ flow\ feature\ start} new-demo 进行分支创建如下:

bogon:helloworld baxi$ git flow feature start new-demo
Switched to a new branch 'feature/new-demo'

Summary of actions:
- A new branch 'feature/new-demo' was created, based on 'dev'
- You are now on branch 'feature/new-demo'

Now, start committing on your feature. When done, use:

     git flow feature finish new-demo

功能开发成功后,执行\color{red}{git\ flow\ feature\ finish } new-demo

bogon:helloworld baxi$ git flow feature finish new-demo
Switched to branch 'dev'
Your branch is up to date with 'origin/dev'.
Updating 5c7117b..495fcd8
Fast-forward
 src/components/common/com-filter-panel.vue | 1 -
 1 file changed, 1 deletion(-)
Deleted branch feature/new-demo (was 495fcd8).

Summary of actions:
- The feature branch 'feature/new-demo' was merged into 'dev'
- Feature branch 'feature/new-demo' has been removed
- You are now on branch 'dev'

管理releases

当你认为现在在 “develop” 分支的代码已经是一个成熟的 release 版本时,这意味着:第一,它包括所有新的功能和必要的修复;第二,它已经被彻底的测试过了。如果上述两点都满足,那就是时候开始生成一个新的 release 了,创建release分支使用版本号命名!

bogon:helloworld baxi$ git flow release start 1.0
Switched to a new branch 'release/1.0'

Summary of actions:
- A new branch 'release/1.0' was created, based on 'dev'
- You are now on branch 'release/1.0'

Follow-up actions:
- Bump the version number now!
- Start committing last-minute fixes in preparing your release
- When done, run:

     git flow release finish '1.0'

完成 release 执行 git flow release finish '1.0'

填写提交merge 信息 以及为标签写一条信息

bogon:helloworld baxi$ git flow release finish '1.0'
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Auto-merging src/components/common/com-filter-panel.vue
Merge made by the 'recursive' strategy.
 src/components/common/com-filter-panel.vue | 1 -
 1 file changed, 1 deletion(-)
Deleted branch release/1.0 (was 495fcd8).

Summary of actions:
- Latest objects have been fetched from 'origin'
- Release branch has been merged into 'master'
- The release was tagged '1.0'
- Release branch has been back-merged into 'dev'
- Release branch 'release/1.0' has been deleted
上一篇 下一篇

猜你喜欢

热点阅读