我在Subversion(以及一般的存储库)讨论中经常看到这些词。 在过去的几年里,我一直在我的项目中使用SVN,但是我从来没有掌握这些目录的完整概念。

它们是什么意思?


当前回答

它们没有任何正式的含义。文件夹就是文件夹 SVN。它们是组织项目的一种普遍接受的方式。

The trunk is where you keep your main line of developmemt. The branch folder is where you might create, well, branches, which are hard to explain in a short post. A branch is a copy of a subset of your project that you work on separately from the trunk. Maybe it's for experiments that might not go anywhere, or maybe it's for the next release, which you will later merge back into the trunk when it becomes stable. And the tags folder is for creating tagged copies of your repository, usually at release checkpoints.

但正如我所说,对于SVN,文件夹就是文件夹。分支、主干和标签只是一种约定。

我随意使用“复制”这个词。SVN实际上并不完全复制存储库中的内容。

其他回答

一般来说(工具不可知的观点),分支是用于并行开发的机制。一个SCM可以有0到n个分支。Subversion是0。

Trunk is a main branch recommended by Subversion, but you are in no way forced to create it. You could call it 'main' or 'releases', or not have one at all! Branch represents a development effort. It should never be named after a resource (like 'vonc_branch') but after: a purpose 'myProject_dev' or 'myProject_Merge' a release perimeter 'myProjetc1.0_dev'or myProject2.3_Merge' or 'myProject6..2_Patch1'... Tag is a snapshot of files in order to easily get back to that state. The problem is that tag and branch is the same in Subversion. And I would definitely recommend the paranoid approach: you can use one of the access control scripts provided with Subversion to prevent anyone from doing anything but creating new copies in the tags area.

标签是最终的。其内容不应改变。从来没有。永远。你忘了发行通知里的一行字?创建一个新标记。淘汰或删除旧的。

现在,我读了很多关于“在某某分支中合并某某,然后最终在主干分支中合并”的内容。 这就是所谓的合并工作流,这里没有强制性的内容。这并不是因为你有一个主干分支,你必须合并回任何东西。

按照惯例,主干分支可以代表您的开发的当前状态,但这是一个简单的顺序项目,该项目具有:

没有“预先”开发(用于准备下一个下一个版本,这意味着这些更改与当前的“主干”开发不兼容) 没有大规模的重构(用于测试新的技术选择) 没有以前版本的长期维护

因为对于这些场景中的一个(或所有),你会得到四个“主干”,四个“当前开发”,而不是你在这些并行开发中所做的所有事情都必须合并回“主干”中。

当我在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.

它们没有任何正式的含义。文件夹就是文件夹 SVN。它们是组织项目的一种普遍接受的方式。

The trunk is where you keep your main line of developmemt. The branch folder is where you might create, well, branches, which are hard to explain in a short post. A branch is a copy of a subset of your project that you work on separately from the trunk. Maybe it's for experiments that might not go anywhere, or maybe it's for the next release, which you will later merge back into the trunk when it becomes stable. And the tags folder is for creating tagged copies of your repository, usually at release checkpoints.

但正如我所说,对于SVN,文件夹就是文件夹。分支、主干和标签只是一种约定。

我随意使用“复制”这个词。SVN实际上并不完全复制存储库中的内容。

中继目录可能是您最熟悉的目录,因为它用于保存最新的更改。你的主要代码库应该在trunk中。

分支目录用于保存分支,无论它们是什么。

标签目录主要用于标记一组特定的文件。您可以对发布版本这样做,其中您希望“1.0”是这些修订版本的这些文件,“1.1”是这些修订版本的这些文件。通常,标签制作完成后就不需要修改了。有关标签的更多信息,请参见第4章。分支和合并(在Subversion版本控制中)。

主干是保存最新源代码和特性的开发线路。它应该包含最新的错误修复以及添加到项目中的最新功能。

分支通常用于做一些远离主干(或其他开发线)的事情,否则会破坏构建。新特性通常构建在分支中,然后合并回主干中。分支通常包含一些代码,这些代码不一定被分支的开发线所批准。例如,程序员可以尝试对分支中的某些内容进行优化,只有在优化令人满意时才会合并回开发线上。

标记是存储库在特定时间的快照。不应该在这些基础上进行任何开发。它们最常用于获取发布给客户端的内容的副本,以便您可以轻松地访问客户正在使用的内容。

这里有一个链接到一个非常好的知识库指南:

源码控制

维基百科上的文章也值得一读。