Author: Lin Wenbo
Original: http://lanbolin.spaces.live.com/blog/cns! 977e13f16fa9e2b5! 768. Entry
Due to fear of the chaos that the branches may bring, some organizations almost never create branches, or even re-start a source code project to avoid the branches. Proper use of branches can greatly improve the development efficiency.
When to use the branch? Typical scenarios or reasons for creating a branch:
(1) You can create
Version Branch In this branch, the bug of the released version is eliminated, and the daily development work is performed on the main line.
(2) During various tests prior to version release, some organizations may require Code Freeze to avoid possible confusion. You can create
Integration Branch Without freezing the code, developers can develop new features on the main line without being affected, and eliminate test bugs on this branch.
(3) You can create
Task Branch To reduce the impact on the main line development (because we need to ensure the stability of the main line as much as possible ).
To use a branch successfully, you must follow the following principles:
(1) Merge as frequently as possible. When the branches are at a stable point, you can consider merging them. Frequent merge operations can effectively reduce conflicts.
(2) ensure that the number of concurrent active branches is as small as possible. The more concurrent active branches, the more conflicting branches are merged into the main line.
(3) avoid long-term branches that must be merged. The longer the branch time, the more conflicts there will be, which will greatly increase the overhead of merging.
(4) reduce the complexity of the branch and avoid re-building the branch on the branch as much as possible.
(5) do not create a branch until you have to create a branch. Creating a branch too early or creating a branch without any need can cause problems.
It can be seen that the above principles all revolve around the theme of reducing the conflicts that the branches may bring and the overhead of merge.
Reference books: Software Configuration Management Mode