Knowledge about the SVN version of branch merging

Source: Internet
Author: User

Merge types for branches

The work of merging is to list all changes in the consolidated scope of the trunk or branch, and to compare the contents of the current working copy, manually modify the conflict by the Consolidator, and then submit it to the appropriate directory on the server. If the current working copy is a trunk, the merge scope is a change on the branch, and if the working copy is branched, the merge scope is a change on the trunk, and it is important to note that the starting location URL of the merge must be the same as the URL of the current working copy.

One, merge a range of versions

This type of application is most widely used, mainly to merge the changes in the branch into the trunk. Right-click on the trunk to select Merge and select merge type: Merge a range of versions. The merged source URL fills in the URL of the branch to be merged, and if the version range to be merged is empty, it refers to all the versions on the merge branch, that is, since the branch was created, all the changes to the current version of the branch. If you select only one version, or several versions, you are simply merging the changes made in n versions onto the trunk. If you select only one of these versions, then the change is only selected for that version, and the previous or subsequent modifications will not be accepted.

Ii. Rehabilitation and merger

Renaissance merging can be understood as a special case of the first type of merging, in which the trunk can be understood to be that there has been no modification since the branch was created, and that the branch has been modified, and that the branch in the merge has no version selected. After a revival merge, all the changes in the branch are merged into the trunk, and the results of the merge will make the branches and trunk identical, so that the branches can be deleted.

Iii. merging two different trees

This type differs from the first two types in that it is possible to select the version of the branch merge, the trunk cannot select the version, and the second type is that both the trunk and the branch cannot select the merged version, and this type is the version that can be merged whether the trunk or the branch is selected. That is, you can select a trunk version of the past to merge with a version of the branch. Merging is based on the selected branch version, and if the selected trunk version differs from the branch version, the trunk portion is discarded when merging.

Start URL: Select the URL of the skeleton directory (should match the URL of the current working copy, this is the so-called merge point)

End URL: Select the URL of the branch you want to merge.

Start and end versions: the general starting version should find the version that was last synchronized, if it has never been synchronized (the first merge), select the version when the branch was created, the end version is generally the latest version, and if you don't want to merge some content into the trunk, you can also select a merge point.

Instance:

Trunk A creates branch B at version 95, when both trees are 95 versions

1, I add the file test.txt on branch B, submit. The repository is now upgraded to version 96;

2, I select merge Type 1 on a, merge the latest version of the branch, the result is to add test.txt A;

3, I select merge Type 2 on a, merge the latest version of the branch, the result is as above;

4, I select merge Type 3 on a, merge the latest version of the branch, the result is as above;

5, I add File test2.txt on a, submit, this time the repository upgrade to the 97 version;

6, I select merge Type 1 on a, merge the latest version of the branch, the result is to add test.txt A;

7, I select merge Type 2 on a, merge the latest version of the branch, the result is to add test.txt A;

8, I select merge Type 3 on a, the backbone select the current 97 version, merge the latest version of the branch, the result is to add Test.txt A, test2.txt from a delete;

9, I select merge Type 3 on a, the previous version of Skeleton 97, merge the latest version of the branch, the result is to add test.txt a, and a to retain the test2.txt.

Merging the branches into the trunk begins with the working copy of the trunk, which begins with the last consolidated version of the trunk to the end of the latest version on the branch, and, if it is the first merge, starts with the version of the trunk to create the branch, so each merge is illustrated in the log, Or forget the next time the merger is a bit of trouble. In fact, should try to avoid a branch merge multiple times, the role of the branch in general in order to solve the bug, once the bug corresponds to the end, the branch of the mission is over, and other problems later, you should re-establish the branch, so that there will be no multiple merging problems.

Merge depth of the branch

Merge Depth:

First, the working copy: that is your current working directory, the general default is this option;

Second, full recursion: That is, you choose the directory of the Repository, including its sub-files, sub-folders, including the contents of subfolders;

Third, direct child nodes, including folders: That is, the directory you select the following files, folders, but not including the folder inside the sub-files, subfolders;

Four, only the file sub-node: That is, you select the directory below the file, but not the folder, of course, not included in the folder below all the content is not included in the merge scope;

Five, only this: there is no merged content.

Instance:

1, the Backbone Test folder has Text.txt file, the test folder to create a branch test2

2, add the Test21 folder under the Test2 folder, add the folder test211 under the Test21 folder, Add the file Test211.txt under the test211 folder, modify the file Test.txt under the Test2 folder, and add the file test2.txt. Submit

3. Right-click the test folder to merge Test2 folder and select Working Copy. The original Test.txt file in the test folder displays the modified state, the Test2.txt file shows the new status, the folder test21 and test211, and the Test211.txt files inside are displayed as new. Select the test folder svn restore, the new folder or file is displayed as no version control state, the original test.txt revert to the normal normal.

4, right-click the Test folder Merge Test2 folder, select Full recursion, results and 31 samples. However, our previous Test folder and the contents of the test on the warehouse are consistent, if not consistent, then select Full recursion, is the warehouse version of the standard. Select a working copy, as the name implies, is based on your local working copy file, the branch has a folder or files that are not in the working copy are not compared to merge.

5. Right-click Test folder Merge Test2 folder, select Direct child node, include folder. The original Test.txt file in the test folder appears as a modified state, the Test2.txt file appears as new, the Test21 folder appears as a new state, but its contents are empty, it proves that the contents below the Test21 folder in the branch are not merged into the skeleton test, and the merge behavior is just The current directory is selected. Select the test folder svn restore, the new folder or file is displayed as no version control state, the original test.txt revert to normal state.

6. Right-click the test folder to merge the Test2 folder and select only the file sub-nodes. The original Test.txt file in the test folder appears as a modified state, the Test2.txt file appears as a new state, and the test21 folder in the branch test2 is not merged into Test. Select the test folder svn restore, the new state of the file is displayed as no version control state, the original test.txt revert to normal state.

7. Right-click the test folder to merge the Test2 folder, select only this item. The test folder appears as a modified state, but the content has no changes. If you restore the Test folder svn, the folder appears as a regular state.

Records merge only (prevents these versions from being merged in the future)

Selecting this means that there is no actual merge action, except that SVN will filter out this version of the modification action during future merges. For example, in the process of merging, I chose to record only the merge for the 23 version of the branch (preventing this version from being merged in the future), then the 23 version will not be merged into the trunk. In a later merge, if you choose the 22 to 24 version of the merge branch, the 23 version will be ignored, and we can see that the 23 version of the font is grayed out in the Select Version dialog box. So to use this option carefully, once used, it means that this version will not be used in subsequent merges.

Ignore ancestors: If there is a file on the branch has been deleted, and later added a file with the same file name, then in the merge SVN will recognize that these two files are not the same ancestor and directly overwrite the old file to add new files. And actually I'm going to merge these two different ancestors ' files, and this time I need to use the SVN merge--ignore-ancestry to ignore the ancestors for the merge to be sure.

Instance:

1, the backbone test to create a branch test1;

2, the Test1 folder under the Test.txt file Delete, submit;

3, in Test1 under the creation of file Test.txt, submit;

4, Merge Test1 to the backbone test, if the default selection, you will be prompted to replace the Test1 in the Test.txt file in the test folder Test.txt file, if you choose to ignore ancestors, then the system will compare two test.txt, if necessary, to prompt the conflict.

Carriage return is a symbol (a carriage return symbol CR), and generally in a code file or stylistic file (under Windows) the line is CR and LF (that is, \ r \ n or hex code 0D 0A), and you have only CR in the line, so you will add a LF (ie OA). Very clear, in fact, LF is a line feed shorthand. Whitespace includes line feeds, tabs, spaces, and carriage returns.

Knowledge about the SVN version of branch merging

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.