svn--Branch, Merge

Source: Internet
Author: User

First, why we need to use branching-merging. 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.

The following is a detailed use of the Subeclipse plugin under Eclipse:
First build a project called Facebook
1. Create a branch, specify access to the new branch url:facebook3[note don't 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 "URL is 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.




The following 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 instead of"
Target 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 on Merge and you will find a new file fb3.html
in the trunk version. 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 a comment when creating a branch.
2. It is a good idea to ensure that two versions are clean before merging, "i.e. there are no uncommitted or conflicting files"
3. Target path when merging: whose URL needs to be incorporated into the other version.


The SVN command line output for the entire procedure is as follows:
  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
  1. <span style="FONT-SIZE:12PX;" >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
  22. </span>


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.
    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. 1549, Placiistore,/source%20code/placiistore,branch " e:/myeclipse/workspace/placii   
    3. Span style= "FONT-SIZE:12PX;" >switch svn://192.168.1.192/placii/trunk/code/server/source code/placiistore e:/myeclipse/ Workspace/placii -rhead   
    4.      at revision 1550.  
    1. <span style="FONT-SIZE:12PX;" >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. </span>

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.

svn--Branch, 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.