我在Subversion(以及一般的存储库)讨论中经常看到这些词。 在过去的几年里,我一直在我的项目中使用SVN,但是我从来没有掌握这些目录的完整概念。
它们是什么意思?
我在Subversion(以及一般的存储库)讨论中经常看到这些词。 在过去的几年里,我一直在我的项目中使用SVN,但是我从来没有掌握这些目录的完整概念。
它们是什么意思?
当前回答
One of the reasons why everyone has a slightly different definition is because Subversion implements zero support for branches and tags. Subversion basically says: We looked at full-featured branches and tags in other systems and did not found them useful, so we did not implement anything. Just make a copy into a new directory with a name convention instead. Then of course everyone is free to have slightly different conventions. To understand the difference between a real tag and a mere copy + naming convention see the Wikipedia entry Subversion tags & branches.
其他回答
主干是保存最新源代码和特性的开发线路。它应该包含最新的错误修复以及添加到项目中的最新功能。
分支通常用于做一些远离主干(或其他开发线)的事情,否则会破坏构建。新特性通常构建在分支中,然后合并回主干中。分支通常包含一些代码,这些代码不一定被分支的开发线所批准。例如,程序员可以尝试对分支中的某些内容进行优化,只有在优化令人满意时才会合并回开发线上。
标记是存储库在特定时间的快照。不应该在这些基础上进行任何开发。它们最常用于获取发布给客户端的内容的副本,以便您可以轻松地访问客户正在使用的内容。
这里有一个链接到一个非常好的知识库指南:
源码控制
维基百科上的文章也值得一读。
我认为一些混淆来自标记概念和SVN中的实现之间的差异。对于SVN来说,标签是一个分支,它是一个副本。修改标签被认为是错误的,事实上,像TortoiseSVN这样的工具会警告你,如果你试图用../tags/..在路上。
在SVN中,标记和分支非常相似。
标签=在时间上定义的片段,通常用于发布
分支=在开发过程中定义的片段,通常用于1.0、1.5、2.0等主要版本,然后在发布时标记分支。这允许您继续支持产品版本,同时在主干中进行突破性的更改
Trunk =开发工作空间,这是所有开发应该发生的地方,然后从分支发布合并回来的更改。
当我在OpenCV 2计算机视觉应用编程烹饪书的作者的网站上查找时,我发现了这个关于SVN的很棒的教程,我想我应该分享一下。
他有一个关于如何使用SVN的教程,以及短语“trunk”、“tag”和“branch”的含义。
直接引用自他的教程:
The current version of your software project, on which your team is currently working is usually located under a directory called trunk. As the project evolves, the developer updates that version fix bugs, add new features) and submit his changes under that directory. At any given point in time, you may want to freeze a version and capture a snapshot of the software as it is at this stage of the development. This generally corresponds to the official versions of your software, for example, the ones you will deliver to your clients. These snapshots are located under the tags directory of your project. Finally, it is often useful to create, at some point, a new line of development for your software. This happens, for example, when you wish to test an alternative implementation in which you have to modify your software but you do not want to submit these changes to the main project until you decide if you adopt the new solution. The main team can then continue to work on the project while other developer work on the prototype. You would put these new lines of development of the project under a directory called branches.
这就是关于软件开发的事情,没有一致的知识,每个人似乎都有自己的方式,但这是因为它是一个相对年轻的学科。
这是我简单的方法,
trunk - trunk目录包含最新的、已批准的和合并的工作主体。与许多人所承认的相反,我的箱子只用于干净、整洁、合格的工作,而不是一个开发区域,而是一个释放区域。
在某个给定的时间点上,当主干似乎已经准备好释放时,它就会被标记并释放。
分支——分支目录包含实验和正在进行的工作。分支下的工作一直停留在那里,直到被批准合并到主干中。对我来说,这是所有工作完成的区域。
例如:我可以有一个迭代-5分支用于产品的第5轮开发,可能有一个原型-9分支用于第9轮实验,等等。
tags—标签目录包含已批准的分支和中继发布的快照。每当一个分支被批准合并到主干中,或者一个发布是由主干组成的,一个被批准的分支或主干发布的快照就会在标记下生成。
我想有了标签,我可以很容易地在时间里来回跳转到感兴趣的点。