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
- Copy-rhead SVN: // 192.168.1.192/placii/staggingarea/xiangqi/Facebook SVN: // 192.168.1.192/placii/staggingarea/xiangqi/facebook3
- Propset subclipse: tags "1538, facebook2,/facebook2, Branch
- 1540, facebook3,/facebook3, branch "E:/myeclipse/workspace/Facebook
- Switch 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.html
- Commit-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
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
- 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
- Propset subclipse: tags "1527, placiistore,/source code/placiistore, Branch
- 1549, placiistore,/source % 20 code/placiistore, branch "E:/myeclipse/workspace/placii
- Switch SVN: // 192.168.1.192/placii/trunk/code/Server/source code/placiistore E:/myeclipse/workspace/placii-rhead
- 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 ~