What are the benefits of creating feature branches?

当使用Git进行源代码控制时,使用功能分支而不是仅仅提交到“开发”分支有什么好处?


Very short answer

It's a mechanism of maintaining code stability; if you and I are on a team; and you want to add a feature; while I am trying to debug an existing problem; I don't want you to commit into the current develop branch and throwing off my base;

Detailed Discussion

There is a nice overview of this at http://nvie.com/posts/a-successful-git-branching-model/

Have a read.


There are several benefits, I'll give you two of the biggest

  • You can work on several features and switch between the two until they are finish or discarded. If discarded all traces if them will be removed.
  • You can commit "dirty" states on your local feature branch and then squash them together to form one commit for the entire feature on to the master/devel branch.

  • These kind of separation prevents some confusions between versions. More than one working space provides you more flexible environment while you are working on two or more different features or bugs at the same time.

    You can check this link for better strategy :

    http://nvie.com/posts/a-successful-git-branching-model/

    链接地址: http://www.djcxy.com/p/45076.html

    上一篇: 分支和合并

    下一篇: 创建功能分支有什么好处?