Use of trunk, branches, tag in SVN

Source: Internet
Author: User

I believe that beginners are not likely to consider the flexibility of using SVN to manage the version of the development code when it comes to SVN as a version management, and I'll extract an article to briefly explain the usage of the three file directories in SVN trunk,branched,tags. I'll explain in detail how I applied svntrunk (trunk), branches (branch) and tags (tags). This approach is also called "Branchalways", which is very close. Maybe I'm not talking about the best method, but it will give the novice some explanation, tell them what the trunk, branches and tags are, and how to apply them.  --A simple contrastThe working mechanism of SVN is like a growing tree in some way:a tree with a trunk and many branchesA branch grows out of a trunk, and a thin branch grows from a relatively coarse trunk.a tree can have only a trunk without branches (but this will not last long, and as the tree grows, there will certainly be branches, ^^)a tree without a trunk but with many branches looks more like a bundle of sticks on the floor.If the trunk is diseased, eventually the branch will be affected, and the whole tree will die.If the branch is sick, you can cut it off, and then the other branches will grow out of the Oh! If the branch grows too fast, it can be very heavy for the trunk, and eventually the whole tree will collapse.when you feel that your tree, trunk, or branch looks beautiful, you can take a picture of it so that you can remember how good it was at that time.  --trunkThe svn composition Trunka,trunk is the primary environment for placing stable code, like a car factory that assembles the finished car parts together. The following will show you how to use Svntrunk:unless you have to deal with bugs that are easy and quick to fix, or you have to add irrelevant logic files (such as media files: images, videos, CSS, and so on), you should never do development in the trunk directly .Do not make too much of a change to the previous version because of a particular need, how the relevant situation implies the need to create a branch (as described below)do not submit some content that might disrupt the trunk, such as merging from branchIf at some point you accidentally break the Trunk,bringsomecakethenextday ("Withgreatresponsibilitiescome...hugecakes") --branchesSVN is composed of branches, a branch is a generic copy from subtree in an SVN repository. Normally it works like a symbolic link on a UNIX system, but once you've modified some files in a svnbranch, and the modified files evolve independently from the copied source files, you can't think of it that way. When a branch is completed, and it is considered stable enough, it must be merged back to its original copy, that is, if it was originally copied from the trunk, it should go back to the trunk, or merge back to its original copy of the parent branch. The following will show you how to use Svnbranches:If you need to modify your application, or develop a new feature for it, create a new branch from the trunk and develop it based on this new branchunless you have to create a new child branch from a branch, the new branch must be created from the trunkWhen you create a new branch, you should switch the past immediately. If you didn't, why did you create this branch in the first place?  --tagssvn makes up tags. On the surface, there is no difference between svnbranches and svntags, but conceptually, there are many differences. In fact, a svntags is the "take a picture of this tree" as described above: a trunk or a named snapshot of a branch revision. The following will show you how to use Svntags:as a developer, never switch to, remove, or submit anything to a svntag: a tag is like some kind of "photo", not a real thing, tags are only readable, not writable. in environments where special or special attention is required, such as: production environment (production),? (staging), test environment (testing), etc., only from a fixed (fixed) tag checkout and update, never commit to a tag. for the above mentioned environment, you can create the following tags: "production", "staging", "testing" and so on. You can also name the tag according to the software version, the maturity level of the project: "1.0.3", "stable", "latest" and so on. when the trunk is stable and can be released externally, it is necessary to recreate the tags accordingly, and then update the relevant environment (PRODUCTION,STAGING,ETC) --workflow ExampleSuppose you have to add a feature to a project, and the project is versioned, you almost need to complete the following steps:use Svncheckout or Svnswitch to get a new working copy from the trunk of this project (branch)use SVN to switch to the new branchcomplete the development of new features (of course, do enough testing, including before you start coding)Once this feature is complete and stable (submitted), and is confirmed by your colleagues, switch to trunkMerge your branches into your work copy (trunk) and resolve a series of conflictsre-examine the merged codeif possible, trouble your colleague to review the code you have written and changed (review)submit a merged work copy to TrunkIf some deployments require a special environment (build environment, etc.), update the relevant tag to the revision you just submitted to the trunk, and use svnupdate to deploy to the relevant environment
    1. Brief introduction
      1. We all know that SVN is the software that manages the source code of the project, can record the code of each stage of our development, for us to use later, then SVN concrete structure you know? Let's take a look at the basic structure of this
  1. Trunk, Branches, Tags, role
      1. Trunk
        1. This is the main branch of the SVN directory, which represents the project in the daily development, and any time the trunk contains the latest development code. The code here will work to your next major release.
        2. Trunks should only be used to develop code that will be the next important version of you.
        3. Almost always people use trunks only to store their code. After releasing a version, continue with the next version of development on it. This development is mixed, if a large bug is often not good to revert to the previous version, thus adding a branches file
      1. Branches
        1. There are several types of branches branches commonly used, which are listed here.
        2. Release Branches
          1. When the trunk reaches the stage of preparation for release (or if you want to freeze the addition of new features), you should create a release branches.
        1. Bug Fix Branches
          1. Branches can also be used to handle serious bugs found in trunk or release branches.
        1. Experimental branches
          1. Sometimes you want to introduce a new technology into a project. That's good, but of course you don't want to gamble on your entire project. Imagine that you want to change your Web program from PHP4 to PHP5. How long will it take you? During this time your trunk stopped using? Until you've done all the conversion to PHP5.
      1. Tags
        1. In general, tag is used to make a milestone, whether or not release, is a usable version. Here, it should be read-only.
        2. In the SVN tag and branches, in an option to create the difference is not obvious, tags are stored in the trunk is a copy, but is read-only, can not be modified, permissions are different.
  1. Trunk, Branches, tags detailed use
      1. Trunk
        1. Right-click in the folder and select "Create repository Here"
        1. Select "Create folder Structure", then browse the built file structure
    1. Branches
        1. Create
        1. merge
          1. branches to Trunk
            1. This is one of the most commonly used methods.
            2. in the trunk, select the UI folder, right-
                 
            1.  
          1. select "Merge a range of revisions"
            1.  
          1. Select the directory to be merged, select branches in the UI folder
            1.  
          1. merge complete
            1.  
        1. trunk to Branches
          1. branches to Branches
      1. Tags
        1. Mark similar to branches, ibid.
      1. Significance
        1. SVN solves our data backup, version control, data synchronization and other issues facing, so many people love and use, it is a good management knowledge of software tools.
        1. We can also use SVN to manage our knowledge.

http://blog.csdn.net/lilongsheng1125/article/details/8742200

Http://blog.sina.com.cn/s/blog_68b4c68f01019mbs.html

Use of trunk, branches, tag in SVN

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: info-contact@alibabacloud.com 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.