Reposted from: https://www.cnblogs.com/keyi/p/5953649.html
I believe that when beginners develop SVN as version management, it is estimated that it is impossible to consider how to use SVN flexibly to manage the version of the development code. Below I will extract an article to briefly explain the trunk, branched, and tags in SVN. The usage of the three file directories.
I will explain in detail how I use SVNtrunk (trunk), branches (branch) and tags (tags). This method is also called “branchalways”, and the two are very close. Maybe what I have introduced is not the best method, but it will give newbies some explanations, tell them what trunk, branches, and tags are, and how to apply them.
——Simple comparison
The working mechanism of SVN is like a growing tree to some extent:
A tree with a trunk and many branches
Branches grow from the trunk, and thin branches grow from a relatively thick trunk
A tree can only have a trunk without Branch (but this situation will not last long, as the tree grows, there will definitely be branches, ^^)
A tree without a trunk but with many branches looks more like on the floor A bunch of branches of the tree
If the trunk is sick, the branches will eventually be affected, and then the whole tree will die.
If the branch is sick, you can cut it, Then other branches will grow out!
If the branch grows too fast, it may be very heavy for the trunk, and eventually the whole tree will collapse.
When you feel that your tree, trunk or branch looks very When it’s beautiful, you can take a picture of it so that you can remember how awesome it was at that time.
——Trunk
SVN constitutes Trunk. Trunk is the main environment for placing stable codes, just like an automobile factory, responsible for assembling finished car parts Together.
The following will tell you how to use SVNtrunk:
Unless you have to deal with some bugs that are easy and quick to solve, or you have to add some unrelated logic files (such as media files: Images, videos, CSS, etc.), otherwise you should never develop directly in the trunk
Don’t make too many changes to the previous version because of special needs. Any relevant situation means the need to build A branch (described below)
Do not submit some content that may damage the trunk, such as merging from the branch
If you accidentally damage the trunk at some point, bringsomecakethenextday(“withgreatresponsibilitiescome) …Hugecakes”)
——Branches
SVN forms branches, and a branch is an ordinary copy made from a subtree in an SVN warehouse. Normally, it works like symbolic links on UNIX systems, but once you modify some files in an SVNbranch, and these modified files develop independently from the copied source files, you can’t think so. When a branch is completed and it is considered stable enough, it must be merged back to where it was originally copied, that is to say: if it was originally copied from the trunk, it should go back to the trunk, or merge back to its original The parent branch of the copy.
The following will tell you how to use SVNbranches:
If you need to modify your application or develop a new feature for it, please create a new branch from the trunk , And then develop based on this new branch
Unless it is because a new branch must be created from a branch, the new branch must be created from the trunk
When you create You should switch to a new branch immediately. If you didn’t do this, why did you create this branch in the first place?
——Tags
SVN composes Tags. On the surface, there is no difference between SVNbranches and SVNtags, but conceptually, they have many differences. In fact, an SVNtags is the “photograph of this tree” mentioned above: a named snapshot of a trunk or a branch revision.
The following will tell you how to use SVNtags:
As a developer, never switch to, retrieve, or submit anything to an SVNtag: a tag is like a kind of “photo” “Is not a real thing, tags are only readable, not writable.
In a special environment or an environment that requires special attention, such as: production environment (production),? (Staging), test environment (testing), etc., can only checkout and update from a fixed (fixed) tag, never commit to a tag.
For the environment mentioned above, you can create the following tags: “production”, “staging”, “testing” and so on. You can also name tags according to the software version and the maturity of the project: “1.0.3”, “stable”, “latest” and so on.
When the trunk is stable and can be released to the outside world, the tags must be recreated accordingly, and then the relevant environment (production, staging, etc) must be updated
< div> ——workflow sample
Assuming that you have to add a feature to a project, and the project is under version control, you almost need to complete the following steps:
Use SVNcheckout or SVNswitch to obtain a new working copy (branch) from the trunk of this project
Use SVN to switch to the new branch
Complete the development of new features (of course, to do Enough testing, including before starting coding)
Once this feature is completed and stable (submitted), and confirmed by your colleagues, switch to trunk
Merge your branch To your working copy (trunk) and resolve a series of conflicts A review of the code (review)
Submit the merged working copy to the trunk
If some deployment requires a special environment (generation environment, etc.), please update the relevant tag to The revised version you just submitted to the trunk, use SVNupdate to deploy to the relevant environment
- Introduction
- We all know that SVN is a software that manages the source code of a project. It can record the code of each stage of our development for us later To use it, do you know the specific structure of SVN? Now let’s introduce its basic structure
- Trunk, Branches, Tags, function
- Trunk
- This is the main branch of the SVN directory, which represents projects under daily development, and anytime in Trunk All the latest development codes are included. The code here will work until your next major release.
- Trunk should only be used to develop code that will become your next major version.
- Almost often people only use trunk to store their code. After a version is released, the next version will be developed on it. This development is mixed. If there is a big bug, it is often difficult to restore to the previous version. Therefore, a Branches file is added.
- Branches
- There are several types of commonly used Branches, here are the commonly used ones.
- Release Branches
- When the trunk reaches the stage of preparing for release (or when you want to freeze the addition of new features), you should create a release branches.
- Bug fix branches
- Branches can also be used to deal with serious bugs found in trunk or release branches.
- Experimental branches
- Sometimes you want to introduce a new technology into a project. This is great, but of course you don’t want to bet on your entire project. Imagine you want to change your web application from PHP4 to PHP5. How much time will you spend? During this period, your trunk will stop using? Until you finish all the conversion to PHP5
- Tags
- Under normal circumstances, a tag is used to make a milestone, whether it is a release or not, it is a usable version. Here, it should be read-only.
- In SVN, there is no obvious difference between Tags and Branches when they are created in one option. What is stored in Tags is also a copy of Trunk, which is only read-only and cannot be modified. The permissions are different.
- Trunk, Branches, Tags detailed use
- Trunk
- Right click in the folder and select “Create repository here”
< li value="1">
ol>
- Select “Create folder Structure”, and then browse the created file structure
- < img alt="Share a picture" src="/wp-content/uploads/images/opensource/svn/1626814042049.png" >
ol>
- Branches
- Create
- Merge
- Branches To Trunk
- This way uses The most common type.
- In Trunk, select the UI folder and right click
- As shown in the figure below, select “merge ”
- Select “Merge a range of revisions”
- Select the directory to be merged, here select the UI folder in the branches
- Complete the merger
< li value="2">Trunk To Branches
- Branches To Branches
< /ol>
- Tags
- Tags are similar to branches, same as above .
- meaning
- SVN solves the problems we face in data backup, version control, data synchronization, etc., so it is loved and used by many people. It is a good software tool for managing knowledge.
- We can also use SVN to manage our knowledge.
I believe in beginner development When SVN is used as version management, it is estimated that it is impossible to consider how to flexibly use SVN to manage the version of the developed code. Below I will extract an article to briefly explain the usage of the three file directories of trunk, branched, and tags in SVN. .
I will explain in detail how I use SVNtrunk (trunk), branches (branch) and tags (tags). This method is also called “branchalways”, and the two are very close. Maybe what I have introduced is not the best method, but it will give newbies some explanations, tell them what trunk, branches, and tags are, and how to apply them.
——Simple comparison
The working mechanism of SVN is like a growing tree to some extent:
A tree with a trunk and many branches
Branches grow from the trunk, and thin branches grow from a relatively thick trunk
A tree can only have a trunk without Branch (but this situation will not last long, as the tree grows, there will definitely be branches, ^^)
A tree without a trunk but with many branches looks more like on the floor A bunch of branches of the tree
If the trunk is sick, the branches will eventually be affected, and then the whole tree will die.
If the branch is sick, you can cut it, Then other branches will grow out!
If the branch grows too fast, it may be very heavy for the trunk, and eventually the whole tree will collapse.
When you feel that your tree, trunk or branch looks very When it is beautiful, you can take a picture of it so that you can remember how awesome it was at that time.
——Trunk
SVN constitutes Trunk. Trunk is the main environment for placing stable codes, just like an automobile factory, responsible for assembling finished car parts Together.
The following will tell you how to use SVNtrunk:
Unless you have to deal with some bugs that are easy and quick to solve, or you have to add some unrelated logic files (such as media files: Images, videos, CSS, etc.), otherwise you should never develop directly in the trunk
Don’t make too many changes to the previous version because of special needs. Any relevant situation means the need to build A branch (described below)
Do not submit some content that may damage the trunk, such as merging from the branch
If you accidentally damage the trunk at some point, bringsomecakethenextday(“withgreatresponsibilitiescome) …Hugecakes”)
——Branches
SVN forms branches, and a branch is an ordinary copy made from a subtree in an SVN warehouse. Normally, it works like symbolic links on UNIX systems, but once you modify some files in an SVNbranch, and these modified files develop independently from the copied source files, you can’t think so. When a branch is completed and it is considered stable enough, it must be merged back to where it was originally copied, that is to say: if it was originally copied from the trunk, it should go back to the trunk, or merge back to its original The parent branch of the copy.
The following will tell you how to use SVNbranches:
If you need to modify your application or develop a new feature for it, please create a new branch from the trunk , And then develop based on this new branch
Unless it is because a new branch must be created from a branch, the new branch must be created from the trunk
When you create You should switch to a new branch immediately. If you didn’t do this, why did you create this branch in the first place?
——Tags
SVN composes Tags. On the surface, there is no difference between SVNbranches and SVNtags, but conceptually, they have many differences. In fact, an SVNtags is the “photograph of this tree” mentioned above: a named snapshot of a trunk or a branch revision.
The following will tell you how to use SVNtags:
As a developer, never switch to, retrieve, or submit anything to an SVNtag: a tag is like a kind of “photo” “Is not a real thing, tags are only readable, not writable.
In special environments or environments that require special attention, such as: production environment (production),? (Staging), test environment (testing), etc., can only checkout and update from a fixed (fixed) tag, never commit to a tag.
For the environment mentioned above, you can create the following tags: “production”, “staging”, “testing” and so on. You can also name tags according to the software version and the maturity of the project: “1.0.3”, “stable”, “latest” and so on.
When the trunk is stable and can be released to the outside world, the tags must be recreated accordingly, and then the relevant environment (production, staging, etc) must be updated
< div> ——workflow sample
Assuming that you have to add a feature to a project, and the project is under version control, you almost need to complete the following steps:
Use SVNcheckout or SVNswitch to obtain a new working copy (branch) from the trunk of this project
Use SVN to switch to the new branch
Complete the development of new features (of course, to do Enough testing, including before starting coding)
Once this feature is completed and stable (submitted), and confirmed by your colleagues, switch to trunk
Merge your branch To your working copy (trunk) and resolve a series of conflicts A review of the code (review)
Submit the merged working copy to the trunk
If some deployment requires a special environment (generation environment, etc.), please update the relevant tag to The revised version you just submitted to the trunk, use SVNupdate to deploy to the relevant environment
- Introduction
- We all know that SVN is a software that manages the source code of a project. It can record the code of each stage of our development for us later To use it, do you know the specific structure of SVN? Now let’s introduce its basic structure
- Trunk, Branches, Tags, function
- Trunk
- This is the main branch of the SVN directory, which represents projects under daily development, and anytime in Trunk All the latest development codes are included. The code here will work until your next major release.
- Trunk should only be used to develop code that will become your next major version.
- Almost often people only use trunk to store their code. After a version is released, the next version will be developed on it. This development is mixed. If there is a big bug, it is often difficult to restore to the previous version. Therefore, a Branches file is added.
- Branches
- There are several types of commonly used Branches, here are the commonly used ones.
- Release Branches
- When the trunk reaches the stage of preparing for release (or when you want to freeze the addition of new features), you should create a release branches.
- Bug fix branches
- Branches can also be used to deal with serious bugs found in trunk or release branches.
- Experimental branches
- Sometimes you want to introduce a new technology into a project. This is great, but of course you don’t want to bet on your entire project. Imagine you want to change your web application from PHP4 to PHP5. How much time will you spend? During this period, your trunk will stop using? Until you finish all the conversion to PHP5
- Tags
- Under normal circumstances, a tag is used to make a milestone, whether it is a release or not, it is a usable version. Here, it should be read-only.
- In SVN, there is no obvious difference between Tags and Branches when they are created in one option. What is stored in Tags is also a copy of Trunk, which is only read-only and cannot be modified. The permissions are different.
- Trunk, Branches, Tags detailed use
- Trunk
- Right click in the folder and select “Create repository here”
< li value="1">
ol>
- Select “Create folder Structure”, and then browse the created file structure
- < img alt="Share pictures" src="/wp-content/uploads/images/opensource/svn/1626814042054.png" >
ol>
- Branches
- Create
- Merge
- Branches To Trunk
- This way uses The most common type.
- In Trunk, select the UI folder and right click
- As shown in the figure below, select “merge ”
- Select “Merge a range of revisions”
- Select the directory to be merged, here select the UI folder in the branches
- Complete the merger
- Trunk To Branches
- Branches To Branches
li>
- Tags
- The tags are similar to branches, same as above.
- Meaning
- SVN solves the problems we face in data backup, version control, data synchronization, etc., so it is loved and used by many people. It is a good software tool for managing knowledge.
- We can also use SVN to manage our knowledge.
I believe that beginner development is not likely to be considered when SVN is used as version management On how to flexibly use SVN to manage the version of the development code, I will excerpt an article below to briefly explain the usage of the three file directories of trunk, branched, and tags in SVN.
I will explain in detail how I use SVNtrunk (trunk), branches (branch) and tags (tags). This method is also called “branchalways”, and the two are very close. Maybe what I have introduced is not the best method, but it will give newbies some explanations, tell them what trunk, branches, and tags are, and how to apply them.
——Simple comparison
The working mechanism of SVN is like a growing tree to some extent:
A tree with a trunk and many branches
Branches grow from the trunk, and thin branches grow from a relatively thick trunk
A tree can only have a trunk without Branch (but this situation will not last long, as the tree grows, there will definitely be branches, ^^)
A tree without a trunk but with many branches looks more like on the floor A bunch of branches of the tree
If the trunk is sick, the branches will eventually be affected, and then the whole tree will die.
If the branch is sick, you can cut it, Then other branches will grow out!
If the branch grows too fast, it may be very heavy for the trunk, and eventually the whole tree will collapse.
When you feel that your tree, trunk or branch looks very When it is beautiful, you can take a picture of it so that you can remember how awesome it was at that time.
——Trunk
SVN constitutes Trunk. Trunk is the main environment for placing stable codes, just like an automobile factory, responsible for assembling finished car parts Together.
The following will tell you how to use SVNtrunk:
Unless you have to deal with some bugs that are easy and quick to solve, or you have to add some unrelated logic files (such as media files: Images, videos, CSS, etc.), otherwise you should never develop directly in the trunk
Don’t make too many changes to the previous version because of special needs. Any relevant situation means the need to build A branch (described below)
Do not submit some content that may damage the trunk, such as merging from the branch
If you accidentally damage the trunk at some point, bringsomecakethenextday(“withgreatresponsibilitiescome) …Hugecakes”)
——Branches
SVN forms branches, and a branch is an ordinary copy made from a subtree in an SVN warehouse. Normally, it works like symbolic links on UNIX systems, but once you modify some files in an SVNbranch, and these modified files develop independently from the copied source files, you can’t think so. When a branch is completed and it is considered stable enough, it must be merged back to where it was originally copied, that is to say: if it was originally copied from the trunk, it should go back to the trunk, or merge back to its original The parent branch of the copy.
The following will tell you how to use SVNbranches:
If you need to modify your application or develop a new feature for it, please create a new branch from the trunk , And then develop based on this new branch
Unless it is because a new branch must be created from a branch, the new branch must be created from the trunk
When you create You should switch to a new branch immediately. If you didn’t do this, why did you create this branch in the first place?
——Tags
SVN composes Tags. On the surface, there is no difference between SVNbranches and SVNtags, but conceptually, they have many differences. In fact, an SVNtags is the “photograph of this tree” mentioned above: a named snapshot of a trunk or a branch revision.
The following will tell you how to use SVNtags:
As a developer, never switch to, retrieve, or submit anything to an SVNtag: a tag is like a kind of “photo” “Is not a real thing, tags are only readable, not writable.
In special environments or environments that require special attention, such as: production environment (production),? (Staging), test environment (testing), etc., can only checkout and update from a fixed (fixed) tag, never commit to a tag.
For the environment mentioned above, you can create the following tags: “production”, “staging”, “testing” and so on. You can also name tags according to the software version and the maturity of the project: “1.0.3”, “stable”, “latest” and so on.
When the trunk is stable and can be released to the outside world, the tags must be recreated accordingly, and then the relevant environment (production, staging, etc) must be updated
< div> ——workflow sample