SVN uses the branch/tag _ merge

Source: Internet
Author: User

First, why do we need to use the branch-merge. For example, there are two teams under Project demo, and SVN has a trunk version. Because of the sudden change in customer demand, resulting in the project needs to make a large change, at this time the team decided by the Group 1 to continue to complete the work of the original half of the "one module", the group 2 to develop new requirements. So at this point, we can set up a branch for group 2, the branch is actually a trunk version of "trunk" a copy version, but the branch is also a version control function, and is independent of the main line, of course, to the end we can through the "merging" function, the branch into the trunk, And eventually merge into one project.

Below is the detailed use of the Subeclipse plugin under eclipse:
First, build a project called Facebook.
1. Create a branch, and specify access to the new branch url:facebook3[note do not forget]






2. After establishing a good score, use the "toggle" function to switch to the branch for development.



I created a new fb3.html file and submitted it under the branch.




3. Switch back to trunk version "that is the URL for Facebook version"

You will find that the trunk version does not appear in the fb3.html we just submitted, because fb3.html belongs to the branch, the next thing we want to do is "merge", by merging, we can merge the changes under the branch into the trunk version.




Here is the main configuration of the merge:
Start path: Trunk version of the path "if you need to merge the trunk version of the changes to the branch is the opposite"
Destination path: Where to get the change "This is the branch path"
You can use the specified version number, where the latest revision is used.



4. Click Merge and you will find a new file under the trunk version fb3.html
This allows us to merge the changes made under the branch into the trunk version.


It is worth noting that:
1. It's a good idea to add comments when creating a branch.
2. It is a good idea to ensure that two versions are clean before merging, "that is, there are no uncommitted or conflicting files."
3. Target path when merging: The URL whose changes need to be merged into other versions.


The SVN command line output for the entire process is as follows:

XML code
  1. Copy-rhead Svn://192.168.1.192/placii/staggingarea/xiangqi/facebook svn://192.168.1.192/placii/staggingarea/ XIANGQI/FACEBOOK3
  2. propset subclipse:tags "1538,facebook2,/facebook2,branch
  3. 1540,facebook3,/facebook3,branch "E:/myeclipse/workspace/facebook
  4. Switch SVN://192.168.1.192/PLACII/STAGGINGAREA/XIANGQI/FACEBOOK3 e:/myeclipse/workspace/facebook-rhead
  5. At Revision 1541.
  6. add-n E:\myeclipse\workspace\Facebook\WebRoot\FB3.html
  7. A e:/myeclipse/workspace/facebook/webroot/fb3.html
  8. commit-m "" E:/myeclipse/workspace/facebook/webroot/fb3.html
  9. Adding e:/myeclipse/workspace/facebook/webroot/fb3.html
  10. transmitting file Data ...
  11. Committed revision 1542.
  12. Switch Svn://192.168.1.192/placii/staggingarea/xiangqi/facebook e:/myeclipse/workspace/facebook-rhead
  13. D e:/myeclipse/workspace/facebook/webroot/fb3.html
  14. Updated to revision 1542.
  15. ===== File Statistics: =====
  16. deleted:1
  17. Merge Svn://192.168.1.192/placii/staggingarea/xiangqi/facebook@head svn://192.168.1.192/placii/staggingarea/ Xiangqi/facebook3@head E:/myeclipse/workspace/facebook
  18. A e:/myeclipse/workspace/facebook/webroot/fb3.html
  19. Merge complete .
  20. ===== File Statistics: =====
  21. added:1
XML code
  1. Copy-rhead Svn://192.168.1.192/placii/staggingarea/xiangqi/facebook svn://192.168.1.192/placii/staggingarea/ XIANGQI/FACEBOOK3
  2. propset subclipse:tags "1538,facebook2,/facebook2,branch
  3. 1540,facebook3,/facebook3,branch "E:/myeclipse/workspace/facebook
  4. Switch SVN://192.168.1.192/PLACII/STAGGINGAREA/XIANGQI/FACEBOOK3 e:/myeclipse/workspace/facebook-rhead
  5. At Revision 1541.
  6. add-n E:\myeclipse\workspace\Facebook\WebRoot\FB3.html
  7. A e:/myeclipse/workspace/facebook/webroot/fb3.html
  8. commit-m "" E:/myeclipse/workspace/facebook/webroot/fb3.html
  9. Adding e:/myeclipse/workspace/facebook/webroot/fb3.html
  10. transmitting file Data ...
  11. Committed revision 1542.
  12. Switch Svn://192.168.1.192/placii/staggingarea/xiangqi/facebook e:/myeclipse/workspace/facebook-rhead
  13. D e:/myeclipse/workspace/facebook/webroot/fb3.html
  14. Updated to revision 1542.
  15. ===== File Statistics: =====
  16. deleted:1
  17. merge Svn://192.168.1.192/placii/staggingarea/xiangqi/[email protected] svn://192.168.1.192/placii/ Staggingarea/xiangqi/[email protected] E:/myeclipse/workspace/facebook
  18. A e:/myeclipse/workspace/facebook/webroot/fb3.html
  19. Merge complete .
  20. ===== File Statistics: =====
  21. added:1



I hope this article will be of some help.
Other references:
Http://www.iteye.com/wiki/subclipse/1626-subclipse-getting-started-guide-and-reference-c



=========================== about merging ==========================
When I merged, I found that the merged file was directly overwritten without the "conflict" that was supposed to occur, and later, after careful study, it was an operational problem.


Suppose my original project was placii, and the establishment of a branch was placiistore. Now you need to merge the branch Placiistore onto the main trunk. That configuration should
1. "Start path": The path of the branch is required here.
2. First revision number: The version number when the branch is established. Record the SVN console when you set up the branch
Mine is.

XML code
    1. Copy-rhead Svn://192.168.1.192/placii/trunk/code/server/source%20code/placii svn://192.168.1.192/placii/ Trunk/code/server/source%20code/placiistore
    2. propset subclipse:tags "1527,placiistore,/source code/placiistore,branch
    3. 1549,placiistore,/source%20code/placiistore,branch "E:/myeclipse/workspace/placii
    4. Switch Svn://192.168.1.192/placii/trunk/code/server/source code/placiistore e:/myeclipse/workspace/placii- Rhead
    5. At revision 1550.
XML code
    1. copy -rhead svn://192.168.1.192/placii/trunk/code/server/source% 20code/placii svn://192.168.1.192/placii/trunk/code/server/source%20code/placiistore  
    2. propset subclipse:tags  "1527,placiistore,/source code/ placiistore,branch  
    3. 1549,placiistore,/source%20code/ Placiistore,branch " E:/MYECLIPSE/WORKSPACE/PLACII  
    4.     at  revision 1550.  


3. Destination path: Use the start path here.
4. Target version number: Use the latest version that is HEAD.

Click Merge and if someone makes a change on the main line version and you change the file on the branch, there will be a conflict. Then manually merge the conflicting code and right-mark it for resolution, which is what we have to do.

Trunk: Skeleton directory, files in this directory are base files
Branches: Branch Directory for development
Tags: The version directory for publishing

is a directory structure that is viewed based on the Eclipse SVN repositores

(Figure 1: directory structure)

2, version of the branch

Branches definition Rules: Project name + datetime + feature points, such as sns-home_20090506_profile, you must add labels when creating each branch.

3, create a new branch

(Figure 2: Start creating a branch)

(Figure 3: Select the branch name and SVN resource path)

(Figure 4: Choose to start branching from head revision or specified revision)

(Figure 5: You must add a callout to this branch)

(Image 5 _ 1: Callout Branch)

4, merging from branch to trunk

1, when the branch version has been developed and tested, can be merged through Subeclipse to the trunk, you can merge the entire project can also be combined with a single file, such as

(Image 8: Multiple branches are changed)

2, if the Hi.java file has changed, then we will select the *trunk* under the Hi.java file (note is not under the branch Hi.java), and then right-click to select the Team->merge command

(Figure 9: Start merge)

3, select the merge pop-up following dialog box, specify the following,

    1. First red Box
      1. The above section selects the file (project) on the corresponding branch of the current file (project), which can be selected by the following Select button
      2. The following section selects the starting version of the merge, which is generally OK when the branch is established, (which version is known based on the comments that were filled in when the branch was established)
    1. The second red box is selected by default and can be used without a tube
    2. The third red box is to select a stable version on the branch
      1. If the final version is determined to be stable, tick "Merge to HEAD revision"
      2. If the final version is not stable, then you can choose a stable version of the previous one, you can select it by following the Select button

Click "Merge" after confirmation and start the merge operation.

(Figure 10: Select a branch and the start and end versions of the branch)

4, after the completion of the merge, the files under the local trunk will be updated, note that this is only merged locally, and you will need to check again if the merged files are correct, and then use Team->commit to submit the merged content after reconfirmation.

5, the proposed merger, and then under the trunk of the modified content to test, it is best to a point at a point of testing, to ensure that the merged content is stable and correct.

5, mark the new version

(Figure 6: Path to the new version)

(Figure 7: Definition rules for the new version)

(Image 11: Tag after merging)

6, references

Http://subclipse.tigris.org/branch_tag.html

SVN uses the branch/tag _ merge

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.