git-flow 初探

安装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 模式会预设两个主分支在仓库中:

  • master 生成分支
  • develop 开发分支

我们接下来进行创建开发功能的分支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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 1 Git Flow介绍 我们都知道, 在 git 的分支功能相对 svn 确实方便许多,而且也非常推荐使用分支来...
    七寸知架构阅读 8,058评论 20 68
  • 原文推荐: A successful Git branching model 这个文章讲的是Git分支模型的原理及...
    SonyaBaby阅读 1,596评论 0 0
  • 1.GitHub 有什么用 学习优秀的开源项目开源社区一直有一句流行的话叫「不要重复发明轮子」,某种意义上正是因为...
    Clemente阅读 1,548评论 1 14
  • 什么是GitFlow? Git Flow定义了一个项目发布的分支模型,为管理具有预定发布周期的大型项目提供了一个健...
    一天大佬阅读 13,324评论 0 5
  • 今天共读第6课:找到“自发型动机”:把目标变为现实。 作者告诉了我们什么是“自发型动机”? 自己内心渴望做出改变的...
    狸猫啊阅读 377评论 3 3

友情链接更多精彩内容