开发者

How to correctly merge 2 branches

开发者 https://www.devze.com 2023-04-09 02:41 出处:网络
I have a master-branch called trunk and a branch of it called prototype has been created. Since the branch happened, commits have been done in both trunk and prototype (sometimes even the same files)

I have a master-branch called trunk and a branch of it called prototype has been created.

Since the branch happened, commits have been done in both trunk and prototype (sometimes even the same files).

What's the best way to update the prototype so that it contains all new commits from the trunk without losing the prototype-commits?

I just tri开发者_Go百科ed to rightclick on my projectfolder -> Team -> Merge, selected the trunk as From: and my prototype as To:. I also checked both Merge from HEAD revision.

But after this some new files of prototype were missing.


First of all, the merge must be done on the working copy of the prototype branch.

A merge consists in applying a diff between two versions of some branch to another branch. The From and the To must thus both point to the trunk. You want to apply, on the prototype branch, the changes made on trunk, from revision X to revision Y.

This is very well explained in the SVN book.


You should first update your branch to get the changes since you have branched (this is easier if you do this frequently). How to achive this is answered here. In short: you do not specify the different subtrees of the repositories but a range of revisions, so the addresses of from and to are most times the same.

After the branch is working correctly with all new files from the trunk you should commit the branch and then merge the changes back to the trunk with the same mechanism. When the branch is closed after the integration into the trunk you should use "reintegrate a branch", but this will make the branch read only.

0

精彩评论

暂无评论...
验证码 换一张
取 消