Gundon
Gundon

Reputation: 2121

How to correctly merge 2 branches

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 tried 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.

Upvotes: 2

Views: 12646

Answers (2)

H-Man2
H-Man2

Reputation: 3189

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.

Upvotes: 0

JB Nizet
JB Nizet

Reputation: 691635

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.

Upvotes: 2

Related Questions