25

I have a branch which I am doing the changes seperately. Other team mates doing the changes in trunk. Scenario is, now I want to give a release including trunk updates + my branch updates. Since I haven't done the complete module yet, I don't want to merge branch to the trunk. Instead I want to create another new branch from trunk and then merge my branch changes to that new Branch. So that I can have the new branch fully updated with my branch updates + latest trunk updates.

I'm using tortoise svn merge and this is what I did:

Let's say in trunk there is a newly added file : A, which is not having in my branch. So the newly created branch also having the file A. (I used the merge option: "Merging Two Different Trees") I go to new branch folder and gave that branch url to the [FROM] field and gave my branch url for the [TO] field. When I did the merge it deletes that A file from the local copy. Apparently what I understand is, merging has taken the new branch state to my branch state, instead of integrating the changes.

What I want is to merge my branch changes to the new branch, without loosing the latest changes that new branch is having. So that I can have the new branch: latest trunk modifications + my branch changes.

How to do this?

Priyan Perera
  • 469
  • 1
  • 8
  • 13
  • This is your current svn, (trunk == newbranch). Now you want to merge your working branch( You know the specific revisions( 200 to 266 and 290, 293 ) need to merge. Please confim is this the preconditions to proceed further? – Ashif Aug 19 '13 at 18:51
  • Yes Olive. I want to merge my branch works to the new branch; which is a exact copy of trunk. Please mention step by step procedure to do so. – Priyan Perera Aug 22 '13 at 05:23

2 Answers2

49
Perform fresh checkout of your repository 
Precondition:( Suppose your repository name: Team )
1. You have trunk( Main Dev )
2. You have branch ( Your changes )
3. Create say "newbranch" from trunk.[ TortoiseSVN->Branch/tag][ Picture1 }Note:Select Head revision

enter image description here

4. Perform svn Update inside "Team"->So newBranch is updated.[picture2]

enter image description here

5. Now, select newbranch and merge[Tortoisesvn->Merge][Picture3]

enter image description here

6. Select default "Merge a range of revision", to select revisions which you only intrested to merge.[[Picture4]

enter image description here

7. Click, showlog to select required revisions you intrested on[picture5]

enter image description here

 Finaly merge is completed[picture6]

enter image description here

**Note: If Conflicts comes across, then merge conflict revisions manually.

Ashif
  • 1,652
  • 14
  • 30
  • 1
    How to merge the "newbranch" back into the "trunk" after the QA is completed? – bsobaid Oct 06 '14 at 19:10
  • You'd need to first merge all changes from trunk to your branch using the 'merge a range of revisions' option, and then once you've done that you 'merge two different trees', choosing your trunk as the 'from' and the branch as your 'to' revision. – keithl8041 Oct 15 '14 at 16:02
  • Nice answer. Shouldn't the `newBranch` be in **branches**? :) – Jean-Francois T. Jul 16 '16 at 02:19
  • @Jean-FrancoisT. It doesn't matter, It can merge to trunk as well. branch/trunk/tag is just a notation for development/simple folder name. – Ashif Jul 20 '16 at 05:19
  • @Ashif. I know you can do it and that's just a convention. But ti's better to keep the conventions when we can :) – Jean-Francois T. Jul 22 '16 at 06:34
3

I would create a new branch from trunk and than merge your branch in the new branch via Merge a range of revisions. Because the new branch is newer all should work fine.

Micha
  • 5,117
  • 8
  • 34
  • 47
  • Yes Micha, that's what I initially did. But because the trunk was updating while I did the development in my branch, It didn't work. To my understanding , If the trunk was not updating, while my branch works, then this method works fine. – Priyan Perera Aug 22 '13 at 05:42
  • Should work, no matter if trunk is updated or not, because of known svn-relationship. Yes, you can receive conflicts, but basically it should work. Before I reintegrated a branch in the trunk I merge the updates form trunk to the branch and than branch (with the new features) in trunk. This helps me to get to much conflicts. – Micha Aug 22 '13 at 06:22