SVN use tutorial--branching, merging

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:
  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. 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.  
    1. <span style=>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 use tutorial--branching, 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.