Some simple opinions on SVN

Source: Internet
Author: User

SVN directory structure composition tutorial


├ ── Project1

│ ─ ── Trunk

│ ─ ── Branches

│ ─ ── Tags

└ ── Project2

│ ─ ── Trunk

│ ─ ── Branches

│ ─ ── Tags


Generally, project1 and project2 are two projects.

Trunk is the main line of code for development and stores the correct code that can be run;

If programmers develop new programs or modify bugs, they generally need to first run the code in the branch (SVN function) trunk directory to a sub-directory in the branches directory,

Modify the code there, confirm it is correct, and then submit it to the Trunk Main Line (but sometimes for efficiency, many of us are developing projects under the trunk directory ).

The tags directory can be seen as a snapshot of the Main Line Code. For example, if you have made 1.0 and 2.0 again, you can take a snapshot of the code of each different version and put it in the tags folder.


The following text is transferred from P = 43 layout of the Subversion Library


Many people ask me, "What is the recommended version library layout ?"," What does trunk mean ?" Or "What does trunk mean ?", This article will try to answer this question.


A Subversion version library implements a version-based file system. The version library is only a file system that contains directories and files, and its file system is version-based, in addition, it achieves "cheap" copying, making this operation much cheaper than the traditional file system, but the version library itself is still like a file system: subversion itself does not have a special directory or name to represent trunk or branches. They are just common directories of the file system, which depends on the meaning of these directory names and structures.


That is to say, the Community has adopted a variety of common la s as the best practice, so one can regard it as a recommendation method. If your version library is publicly accessible, you can easily access the version library to find what they need.


There are two common la s:





The first layout is that the version library contains the best choice for a project or a group of closely related projects. This layout is very useful because the branch and tag of the entire project or a group of projects are very simple, you only need a simple command:


SVN copy URL: // repos/projecta/trunk URL: // repos/projecta/tags/tagname-m "create tagname"


This may be the most commonly used version library layout and is adopted by many open-source projects, like Subversion itself and subclipse. This is the method followed by most host sites, such as,, and Google Code, each project of these sites has its own version library.


Another layout is the best choice for a version library containing unrelated projects.










In this layout, each project will exist in the top-level directory, and trunk/branches/tags will be created under this Directory, which is the same as the first layout, this only replaces projects with their own version libraries, all of which are in the same version library. The Apache Software Foundation uses this layout to store all of their projects in a single version library.


With this layout, each project has its own branch and tag, and you can easily use a command to create branch and tag, as shown in the preceding figure: SVN copy URL: // repos/projecta/trunk URL: // repos/projecta/tags/tagname-M "create tagname" can be used to create tags that contain both projecta and projectb, you can do this, but you need multiple commands. You also need to decide whether to create a special directory to store such branches and labels. If you need to do this frequently, you may consider the first layout.


As for the directory name in the version library, it is just a habit that they have no special meaning in subversion.


"Trunk" can be considered as the main development line of the project. You can call it "Main", "mainline", "production" or any name you like.


"Branches" is the place where branches are placed. People use branches for various purposes. You may want to isolate your distribution or maintenance branches through feature branches or customer-modified branches, in this example, you can create a directory in branches, or just create multiple branch directories in the top-level directory.


"Tags" won't be especially treated by subversion. They just get used to it. Maybe they use hook scripts or authorization rules to force it to indicate that you have created a snapshot at a time point, generally, the difference between a tags and a branch is that once a tags is created, it cannot be modified. You can also name the label directory "releases", "snapshots", "baselines", or whatever you like. Remember, the name is meaningful to you, not subversion.


Finally, in the Subversion architecture, the global revision often makes tags unnecessary. I don't know what it means to create tags only because of creating tags. If you need to recreate the software at a specific time point, you can use SVN log to determine the version number.

Tags is useful for "external" users of the version library. Maybe the QA/release team needs to perform the build, or an internal development team wants to use the release version for another product, or an external user or customer wants to obtain the release snapshot from the version Library Based on the literal meaning. In these scenarios, creating tags is the easiest way to ensure that the correct code is obtained, A good communication mechanism is also required to specify the snapshot release. I hope this article will clarify some questions for you so that you can better understand how subversion works.

Finally, I want to point out that the layout of the Subversion version library can be modified. You can reorganize and reconstruct the layout all the time. In the worst case, users will be asked to adjust their work copies, but it won't let you start all over again. You should change your name, move the directory, or do anything you want to change the version library.


This article page is good

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.