git flow版本管理简介

http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/


Why aren't you using git-flow?

In January of this year, @nvie published “A successful Git branching model”, in which he explained how he keeps his Git repositories nice and tidy. In addition to that, he released git-flow; a bunch of Git extensions to make following this model extremely easy.

I’m astounded that some people never heard of it before, so in this article I’ll try to tell you why it can make you happy and cheerful all day.

After installing git-flow, you can start a new repository in the current directory or convert an existing one to the new branch structure:

$ git flow init

It will ask you a bunch of questions, but you probably want to accept the default values:

No branches exist yet. Base branches must be created now.
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/] 
Support branches? [support/] 
Version tag prefix? []

After you’ve answered the questions, git flow sets your default branch todevelop (or whatever you named it) automatically, since that’s the one you’ll be working in.

Now, simply use Git like you’re used to, but only work on some small features in the develop branch. If you need to work on a bigger feature, just create a feature branch based on develop. Let’s say you want to add a login page:

$ git flow feature start login

This will create a new branch called feature/login, based on our developbranch and switches to it. Commit away and after you finish working on the login page, simply finish it:

$ git flow feature finish login

It’ll merge feature/login back to develop and delete the feature branch.

When you’re feature complete, simply start a release branch — again, based on develop — to bump the version number and fix the last bugs before releasing:

$ git flow release start v0.1.0

When you finish a release branch, it’ll merge your changes to master andback to develop, so you don’t have to worry about your master being ahead ofdevelop.

The last thing that makes git-flow awesome is it’s ability to handle hotfixes. You start and finish a hotfix branch like anything else, but it’s based on masterso you can quickly fix it when something’s broken production and merge it back to master and develop using finish.

Awesome, right? Now, what are you waiting for?


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值