龍·涅槃

导航

What do 'branch', 'tag' and 'trunk' mean in Subversion repositories?

自:http://stackoverflow.com/questions/16142/what-do-branch-tag-and-trunk-mean-in-subversion-repositories

----------------

  • Trunk would be the main body of development, originating from the start of the project until the present.

  • Branch will be a copy of code derived from a certain point in the trunk that is used for applying major changes to the code while preserving the integrity of the code in the trunk. If the major changes work according to plan, they are usually merged back into the trunk.

  • Tag will be a point in time on the trunk or a branch that you wish to preserve. The two main reasons for preservation would be that either this is a major release of the software, whether alpha, beta, RC or RTM, or this is the most stable point of the software before major revisions on the trunk were applied.

In open source projects, major branches that are not accepted into the trunk by the project stakeholders can become the bases for forks -- e.g., totally separate projects that share a common origin with other source code.

 

 

自:http://blog.163.com/ppy2790@126/blog/static/103242241201210185290382/

--------------------------
Trunk: 主工作目录,从开始编码到当下所有开发功能的,最新版的,测试的,开发中的
Branch: Trunk的一个分支,
        1.Trunk的重要版本发布后 创建一个分支上后可修复Bug,
        2. 在不影响Trunk的前提下,做大幅更改代码,可以创建Branch,有可能与Trunk合并;
Tags: 类似工作中的一个快照,保存特定版本,可以是Trunk,Branch的一个特定点上的快照.

 

 
在SVN中Branch/tag在一个功能选项中,在使用中也往往产生混淆。
 
在实现上,branch和tag,对于svn都是使用copy实现的,所以他们在默认的权限上和一般的目录没有区别。至于何时用tag,何时用branch,完全由人主观的根据规范和需要来选择,而不是强制的(比如cvs)。
 
一般情况下,
tag,是用来做一个milestone的,不管是不是release,都是一个可用的版本。这里,应该是只读的。更多的是一个显示用的,给人一个可读(readable)的标记。
branch,是用来做并行开发的,这里的并行是指和trunk进行比较。
 
比如,3.0开发完成,这个时候要做一个tag,tag_release_3_0,然后基于这个tag做release,比如安装程序等。trunk进入3.1的开发,但是3.0发现了bug,那么就需要基于tag_release_3_0做一个branch,branch_bugfix_3_0,基于这个branch进行bugfix,等到bugfix结束,做一个tag,tag_release_3_0_1,然后,根据需要决定branch_bugfix_3_0是否并入trunk。
 
对于svn还要注意的一点,就是它是全局版本号,其实这个就是一个tag的标记,所以我们经常可以看到,什么什么release,基于xxx项目的2xxxx版本。就是这个意思了。但是,它还明确的给出一个tag的概念,就是因为这个更加的可读,毕竟记住tag_release_1_0要比记住一个很大的版本号容易的多。

posted on 2015-03-11 15:05  龍·涅槃  阅读(109)  评论(0)    收藏  举报