The principle and operation of SVN branch merging

Source: Internet
Author: User
Tags commit svn
First, SVN architecture logic
First, on the trunk code version of the trunk project, create a branch to branches by SVN right-click and complete the new branch, which is a copy of the skeleton code.
1, trunk and branch, can commit, update and other operations, but in the case of no merge, is independent, non-interference;
2, branch version to reduce the deviation from the main line, the code should not be modified in accordance with the skeleton version should be consistent, so should occur before the code to write the trunk-to-branch merge;
3, the trunk code for the Absorption branch code update: If the skeleton code does not occur synchronously, the branch to the trunk of the merge, if the skeleton code is also synchronized in the development, you should often branch to the trunk of the merge to maintain version unity.
4, for the stable backbone version, can be regularly labeled as Tags Directory branch, for publishing.
In the respective branches and the trunk of the code commit, update and other simple operations, and do not interfere with each other, you can rest assured that the local code commit, update, the following focus on the merge operation. Second, the merge operation
The merge operation distinguishes between two categories: A, Trunk-to-branch merge: The code that completes the branch unmodified section, synchronizes with the version of the skeleton Code, and B, the branch-to-trunk merge: Complete the branching code to the skeleton code.
There are several situations when merging from the trunk to the branch:
1, the branch on the unmodified part and the skeleton code version has been (that is, the skeleton code has not changed), the merger is successful, can continue to develop on the branch;
2. The unmodified part of the branch is different from the skeleton code (the skeleton Code is modified): SVN is updated by the skeleton code by default, complete the merge, commit the merged changes to the branch version, then continue to develop in the branch;
3, modify the main conflict with the trunk (trunk and branch have code modification, and the Trunk Modification and branch modification in the same file of the same line of code): the merge process reported a conflict, SVN will jump out of four options to resolve the conflict: 1) with the skeleton modified version, update the local version to the backbone version 2) with the modified version of branch Local, the local version remains unchanged; 3) edit conflict: Will jump out of the interface to manually modify the conflicting document, you need to control the code, refer to different versions, consult with others to edit the file. 4) Postpone the resolution, that is, temporarily ignoring the conflict. After you finish editing, right-click on the conflicting file, select Resolve, then commit to change to the branch version.
Merging from the branch to the trunk is similar, not to repeat. Note that the two types of merge operations, mainly look at the merge source selection, from the branch to the trunk of the merge, in the branch directory, the merge source URL to select the skeleton version of the directory; Accordingly, from the trunk to the branch of the merge, in the trunk directory, the merge source URL to select the branch version directory. third, about the use of habits
Developing good usage habits will help you reduce the conflict in code merge:
1, the use of SVN, you can often operate the submission, update, for their own local code conflicts, can be found in time;
2. Before you edit the code, remember to get the latest version from the Skeleton repository merge. Submit the edited code to the branch repository every day before you leave work.
3, every time the code is submitted, write a clear message, convenient to later own or others to find the reason for the update.

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.