SVN tutorial-branch and merge

Source: Internet
Author: User
Http://energykey.iteye.com/blog/512745 first explains why we need to use branch-merge. For example, there are two groups under the project demo and one trunk under SVN. Due to sudden changes in customer requirements, the project needs to be significantly changed. At this time, the project team decided to continue to complete half of the work that was originally going on [A module ], group 2 develops new requirements. Now, we can create a branch for group 2. The branch is actually a copy version of the trunk [main line], but the Branch also has version control function, it is independent from the Main Line. Of course, we can merge the branches to the trunk through the [merge] function at the end, and finally merge the branches into a project.

The following describes how to use the subeclipse plug-in Eclipse:
First, create a project named Facebook.
1. Create a branch and specify the access URL for the new branch: facebook3 [do not forget to comment]

2. After points are set up, use the "Switch" function to switch to the branch for development.


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

3. switch back to trunk (that is, the URL is Facebook version]

You will find that fb3.html, which we just mentioned, does not exist in trunkversion. Because fb3.html belongs to a branch, what we need to do next is "merge". By merging, We can merge the changes under the branch into the trunk version.

The following are the main configurations for merging:
Start path: Trunk version path [if you need to merge the changes of trunk version into the branch, the opposite is true]
Target path: where to obtain the change [This is the branch path]
You can use the specified version number. The latest version is used here.

4.click merge to find a new file fb3.html added under trunk.
In this way, the changes made under the Branch are merged into the trunk version.

It is worth noting that:
1. It is best to add comments when creating a branch.
2. Before merging, it is best to ensure that both versions are clean [that is, there are no files not submitted or conflicted]
3. Target path during merge: Enter the URL of the target user who needs to merge the changes to another version.

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
Copy-rhead SVN: // 192.168.1.192/placii/staggingarea/xiangqi/Facebook SVN: // 192.168.1.192/placii/staggingarea/xiangqi/facebook3propset subclipse: tags "1538, facebook2,/facebook2, branch1540, facebook3,/facebook3, branch "E:/myeclipse/workspace/facebookswitch SVN: // 192.168.1.192/placii/staggingarea/xiangqi/facebook3 E: /myeclipse/workspace/Facebook-rhead at revision 1541.add-n e: \ myeclipse \ workspace \ Facebook \ webroot \ fb3.html a e: /myeclipse/workspace/Facebook/webroot/fb3.htmlcommit-M "" E:/myeclipse/workspace/Facebook/webroot/fb3.html adding E: /myeclipse/workspace/Facebook/webroot/fb3.html transmitting file data... committed revision 1542. switch SVN: // 192.168.1.192/placii/staggingarea/xiangqi/Facebook E:/myeclipse/workspace/Facebook-rhead d e: /myeclipse/workspace/Facebook/webroot/fb3.html updated to revision 1542. ===== file statistics: ===== deleted: 1 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 a E:/myeclipse/workspace/Facebook/webroot/fb3.html merge complete. ===== file statistics: === added: 1

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

====================================== About merging ====================
During the merger, I found that the merged files were directly overwritten, but there was no [conflict]. Later, after careful research, I found that it was an operational problem.


Assume that my original project is placii and a branch is placiistore. Now we need to merge the branch placiistore into the main line. The configuration should be
1. [start path]: Enter the branch path here.
2. The first revision number: the version number when the branch is created. Record the svn console when creating a branch
My XML Code

  1. Copy-rhead SVN: // 192.168.1.192/placii/trunk/code/Server/source % 20 code/placii SVN: // 192.168.1.192/placii/trunk/code/Server/source % 20 code/placiistore
  2. Propset subclipse: tags "1527, placiistore,/source code/placiistore, Branch
  3. 1549, placiistore,/source % 20 code/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.
Copy-rhead SVN: // 192.168.1.192/placii/trunk/code/Server/source % 20 code/placii SVN: // 192.168.1.192/placii/trunk/code/Server/source % 20 code/placiistorepropset subclipse: tags "1527, placiistore,/source code/placiistore, branch1549, placiistore, /Source % 20 code/placiistore, branch "E:/myeclipse/workspace/placiiswitch SVN: // 192.168.1.192/placii/trunk/code/Server/source code/placiistore E: /myeclipse/workspace/placii-rhead at revision 1550.
3. Target path: the start path is used here.
4. Target version: use the latest version, that is, head.

Click merge. If someone changes the main line version and you change the file on the branch, a conflict will occur. Then, manually merge the conflicting code, right-click it, and mark it as a solution, which achieves our goal.

 

Xiaolong online: It is really useful for SVN branch/merge operations and can be reprinted decisively ~

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.